3197.c29a6f351f8c45adc2c5.js
1    (self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] = self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] || []).push([[3197,7061],{
2    
3    /***/ 77647:
4    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5    
6    "use strict";
7    
8    // EXPORTS
9    __webpack_require__.d(__webpack_exports__, {
10     e: () => (/* reexport */ BaseRegExpVisitor),
11     O: () => (/* reexport */ RegExpParser)
12   });
13   
14   ;// CONCATENATED MODULE: ../node_modules/@chevrotain/regexp-to-ast/lib/src/utils.js
15   function cc(char) {
16       return char.charCodeAt(0);
17   }
18   function insertToSet(item, set) {
19       if (Array.isArray(item)) {
20           item.forEach(function (subItem) {
21               set.push(subItem);
22           });
23       }
24       else {
25           set.push(item);
26       }
27   }
28   function addFlag(flagObj, flagKey) {
29       if (flagObj[flagKey] === true) {
30           throw "duplicate flag " + flagKey;
31       }
32       const x = flagObj[flagKey];
33       flagObj[flagKey] = true;
34   }
35   function ASSERT_EXISTS(obj) {
36       // istanbul ignore next
37       if (obj === undefined) {
38           throw Error("Internal Error - Should never get here!");
39       }
40       return true;
41   }
42   // istanbul ignore next
43   function ASSERT_NEVER_REACH_HERE() {
44       throw Error("Internal Error - Should never get here!");
45   }
46   function isCharacter(obj) {
47       return obj["type"] === "Character";
48   }
49   //# sourceMappingURL=utils.js.map
50   ;// CONCATENATED MODULE: ../node_modules/@chevrotain/regexp-to-ast/lib/src/character-classes.js
51   
52   const digitsCharCodes = [];
53   for (let i = cc("0"); i <= cc("9"); i++) {
54       digitsCharCodes.push(i);
55   }
56   const wordCharCodes = [cc("_")].concat(digitsCharCodes);
57   for (let i = cc("a"); i <= cc("z"); i++) {
58       wordCharCodes.push(i);
59   }
60   for (let i = cc("A"); i <= cc("Z"); i++) {
61       wordCharCodes.push(i);
62   }
63   // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#character-classes
64   const whitespaceCodes = [
65       cc(" "),
66       cc("\f"),
67       cc("\n"),
68       cc("\r"),
69       cc("\t"),
70       cc("\v"),
71       cc("\t"),
72       cc("\u00a0"),
73       cc("\u1680"),
74       cc("\u2000"),
75       cc("\u2001"),
76       cc("\u2002"),
77       cc("\u2003"),
78       cc("\u2004"),
79       cc("\u2005"),
80       cc("\u2006"),
81       cc("\u2007"),
82       cc("\u2008"),
83       cc("\u2009"),
84       cc("\u200a"),
85       cc("\u2028"),
86       cc("\u2029"),
87       cc("\u202f"),
88       cc("\u205f"),
89       cc("\u3000"),
90       cc("\ufeff"),
91   ];
92   //# sourceMappingURL=character-classes.js.map
93   ;// CONCATENATED MODULE: ../node_modules/@chevrotain/regexp-to-ast/lib/src/regexp-parser.js
94   
95   
96   // consts and utilities
97   const hexDigitPattern = /[0-9a-fA-F]/;
98   const decimalPattern = /[0-9]/;
99   const decimalPatternNoZero = /[1-9]/;
100  // https://hackernoon.com/the-madness-of-parsing-real-world-javascript-regexps-d9ee336df983
101  // https://www.ecma-international.org/ecma-262/8.0/index.html#prod-Pattern
102  class RegExpParser {
103      constructor() {
104          this.idx = 0;
105          this.input = "";
106          this.groupIdx = 0;
107      }
108      saveState() {
109          return {
110              idx: this.idx,
111              input: this.input,
112              groupIdx: this.groupIdx,
113          };
114      }
115      restoreState(newState) {
116          this.idx = newState.idx;
117          this.input = newState.input;
118          this.groupIdx = newState.groupIdx;
119      }
120      pattern(input) {
121          // parser state
122          this.idx = 0;
123          this.input = input;
124          this.groupIdx = 0;
125          this.consumeChar("/");
126          const value = this.disjunction();
127          this.consumeChar("/");
128          const flags = {
129              type: "Flags",
130              loc: { begin: this.idx, end: input.length },
131              global: false,
132              ignoreCase: false,
133              multiLine: false,
134              unicode: false,
135              sticky: false,
136          };
137          while (this.isRegExpFlag()) {
138              switch (this.popChar()) {
139                  case "g":
140                      addFlag(flags, "global");
141                      break;
142                  case "i":
143                      addFlag(flags, "ignoreCase");
144                      break;
145                  case "m":
146                      addFlag(flags, "multiLine");
147                      break;
148                  case "u":
149                      addFlag(flags, "unicode");
150                      break;
151                  case "y":
152                      addFlag(flags, "sticky");
153                      break;
154              }
155          }
156          if (this.idx !== this.input.length) {
157              throw Error("Redundant input: " + this.input.substring(this.idx));
158          }
159          return {
160              type: "Pattern",
161              flags: flags,
162              value: value,
163              loc: this.loc(0),
164          };
165      }
166      disjunction() {
167          const alts = [];
168          const begin = this.idx;
169          alts.push(this.alternative());
170          while (this.peekChar() === "|") {
171              this.consumeChar("|");
172              alts.push(this.alternative());
173          }
174          return { type: "Disjunction", value: alts, loc: this.loc(begin) };
175      }
176      alternative() {
177          const terms = [];
178          const begin = this.idx;
179          while (this.isTerm()) {
180              terms.push(this.term());
181          }
182          return { type: "Alternative", value: terms, loc: this.loc(begin) };
183      }
184      term() {
185          if (this.isAssertion()) {
186              return this.assertion();
187          }
188          else {
189              return this.atom();
190          }
191      }
192      assertion() {
193          const begin = this.idx;
194          switch (this.popChar()) {
195              case "^":
196                  return {
197                      type: "StartAnchor",
198                      loc: this.loc(begin),
199                  };
200              case "$":
201                  return { type: "EndAnchor", loc: this.loc(begin) };
202              // '\b' or '\B'
203              case "\\":
204                  switch (this.popChar()) {
205                      case "b":
206                          return {
207                              type: "WordBoundary",
208                              loc: this.loc(begin),
209                          };
210                      case "B":
211                          return {
212                              type: "NonWordBoundary",
213                              loc: this.loc(begin),
214                          };
215                  }
216                  // istanbul ignore next
217                  throw Error("Invalid Assertion Escape");
218              // '(?=' or '(?!'
219              case "(":
220                  this.consumeChar("?");
221                  let type;
222                  switch (this.popChar()) {
223                      case "=":
224                          type = "Lookahead";
225                          break;
226                      case "!":
227                          type = "NegativeLookahead";
228                          break;
229                  }
230                  ASSERT_EXISTS(type);
231                  const disjunction = this.disjunction();
232                  this.consumeChar(")");
233                  return {
234                      type: type,
235                      value: disjunction,
236                      loc: this.loc(begin),
237                  };
238          }
239          // istanbul ignore next
240          return ASSERT_NEVER_REACH_HERE();
241      }
242      quantifier(isBacktracking = false) {
243          let range = undefined;
244          const begin = this.idx;
245          switch (this.popChar()) {
246              case "*":
247                  range = {
248                      atLeast: 0,
249                      atMost: Infinity,
250                  };
251                  break;
252              case "+":
253                  range = {
254                      atLeast: 1,
255                      atMost: Infinity,
256                  };
257                  break;
258              case "?":
259                  range = {
260                      atLeast: 0,
261                      atMost: 1,
262                  };
263                  break;
264              case "{":
265                  const atLeast = this.integerIncludingZero();
266                  switch (this.popChar()) {
267                      case "}":
268                          range = {
269                              atLeast: atLeast,
270                              atMost: atLeast,
271                          };
272                          break;
273                      case ",":
274                          let atMost;
275                          if (this.isDigit()) {
276                              atMost = this.integerIncludingZero();
277                              range = {
278                                  atLeast: atLeast,
279                                  atMost: atMost,
280                              };
281                          }
282                          else {
283                              range = {
284                                  atLeast: atLeast,
285                                  atMost: Infinity,
286                              };
287                          }
288                          this.consumeChar("}");
289                          break;
290                  }
291                  // throwing exceptions from "ASSERT_EXISTS" during backtracking
292                  // causes severe performance degradations
293                  if (isBacktracking === true && range === undefined) {
294                      return undefined;
295                  }
296                  ASSERT_EXISTS(range);
297                  break;
298          }
299          // throwing exceptions from "ASSERT_EXISTS" during backtracking
300          // causes severe performance degradations
301          if (isBacktracking === true && range === undefined) {
302              return undefined;
303          }
304          // istanbul ignore else
305          if (ASSERT_EXISTS(range)) {
306              if (this.peekChar(0) === "?") {
307                  this.consumeChar("?");
308                  range.greedy = false;
309              }
310              else {
311                  range.greedy = true;
312              }
313              range.type = "Quantifier";
314              range.loc = this.loc(begin);
315              return range;
316          }
317      }
318      atom() {
319          let atom;
320          const begin = this.idx;
321          switch (this.peekChar()) {
322              case ".":
323                  atom = this.dotAll();
324                  break;
325              case "\\":
326                  atom = this.atomEscape();
327                  break;
328              case "[":
329                  atom = this.characterClass();
330                  break;
331              case "(":
332                  atom = this.group();
333                  break;
334          }
335          if (atom === undefined && this.isPatternCharacter()) {
336              atom = this.patternCharacter();
337          }
338          // istanbul ignore else
339          if (ASSERT_EXISTS(atom)) {
340              atom.loc = this.loc(begin);
341              if (this.isQuantifier()) {
342                  atom.quantifier = this.quantifier();
343              }
344              return atom;
345          }
346          // istanbul ignore next
347          return ASSERT_NEVER_REACH_HERE();
348      }
349      dotAll() {
350          this.consumeChar(".");
351          return {
352              type: "Set",
353              complement: true,
354              value: [cc("\n"), cc("\r"), cc("\u2028"), cc("\u2029")],
355          };
356      }
357      atomEscape() {
358          this.consumeChar("\\");
359          switch (this.peekChar()) {
360              case "1":
361              case "2":
362              case "3":
363              case "4":
364              case "5":
365              case "6":
366              case "7":
367              case "8":
368              case "9":
369                  return this.decimalEscapeAtom();
370              case "d":
371              case "D":
372              case "s":
373              case "S":
374              case "w":
375              case "W":
376                  return this.characterClassEscape();
377              case "f":
378              case "n":
379              case "r":
380              case "t":
381              case "v":
382                  return this.controlEscapeAtom();
383              case "c":
384                  return this.controlLetterEscapeAtom();
385              case "0":
386                  return this.nulCharacterAtom();
387              case "x":
388                  return this.hexEscapeSequenceAtom();
389              case "u":
390                  return this.regExpUnicodeEscapeSequenceAtom();
391              default:
392                  return this.identityEscapeAtom();
393          }
394      }
395      decimalEscapeAtom() {
396          const value = this.positiveInteger();
397          return { type: "GroupBackReference", value: value };
398      }
399      characterClassEscape() {
400          let set;
401          let complement = false;
402          switch (this.popChar()) {
403              case "d":
404                  set = digitsCharCodes;
405                  break;
406              case "D":
407                  set = digitsCharCodes;
408                  complement = true;
409                  break;
410              case "s":
411                  set = whitespaceCodes;
412                  break;
413              case "S":
414                  set = whitespaceCodes;
415                  complement = true;
416                  break;
417              case "w":
418                  set = wordCharCodes;
419                  break;
420              case "W":
421                  set = wordCharCodes;
422                  complement = true;
423                  break;
424          }
425          // istanbul ignore else
426          if (ASSERT_EXISTS(set)) {
427              return { type: "Set", value: set, complement: complement };
428          }
429          // istanbul ignore next
430          return ASSERT_NEVER_REACH_HERE();
431      }
432      controlEscapeAtom() {
433          let escapeCode;
434          switch (this.popChar()) {
435              case "f":
436                  escapeCode = cc("\f");
437                  break;
438              case "n":
439                  escapeCode = cc("\n");
440                  break;
441              case "r":
442                  escapeCode = cc("\r");
443                  break;
444              case "t":
445                  escapeCode = cc("\t");
446                  break;
447              case "v":
448                  escapeCode = cc("\v");
449                  break;
450          }
451          // istanbul ignore else
452          if (ASSERT_EXISTS(escapeCode)) {
453              return { type: "Character", value: escapeCode };
454          }
455          // istanbul ignore next
456          return ASSERT_NEVER_REACH_HERE();
457      }
458      controlLetterEscapeAtom() {
459          this.consumeChar("c");
460          const letter = this.popChar();
461          if (/[a-zA-Z]/.test(letter) === false) {
462              throw Error("Invalid ");
463          }
464          const letterCode = letter.toUpperCase().charCodeAt(0) - 64;
465          return { type: "Character", value: letterCode };
466      }
467      nulCharacterAtom() {
468          // TODO implement '[lookahead ∉ DecimalDigit]'
469          // TODO: for the deprecated octal escape sequence
470          this.consumeChar("0");
471          return { type: "Character", value: cc("\0") };
472      }
473      hexEscapeSequenceAtom() {
474          this.consumeChar("x");
475          return this.parseHexDigits(2);
476      }
477      regExpUnicodeEscapeSequenceAtom() {
478          this.consumeChar("u");
479          return this.parseHexDigits(4);
480      }
481      identityEscapeAtom() {
482          // TODO: implement "SourceCharacter but not UnicodeIDContinue"
483          // // http://unicode.org/reports/tr31/#Specific_Character_Adjustments
484          const escapedChar = this.popChar();
485          return { type: "Character", value: cc(escapedChar) };
486      }
487      classPatternCharacterAtom() {
488          switch (this.peekChar()) {
489              // istanbul ignore next
490              case "\n":
491              // istanbul ignore next
492              case "\r":
493              // istanbul ignore next
494              case "\u2028":
495              // istanbul ignore next
496              case "\u2029":
497              // istanbul ignore next
498              case "\\":
499              // istanbul ignore next
500              case "]":
501                  throw Error("TBD");
502              default:
503                  const nextChar = this.popChar();
504                  return { type: "Character", value: cc(nextChar) };
505          }
506      }
507      characterClass() {
508          const set = [];
509          let complement = false;
510          this.consumeChar("[");
511          if (this.peekChar(0) === "^") {
512              this.consumeChar("^");
513              complement = true;
514          }
515          while (this.isClassAtom()) {
516              const from = this.classAtom();
517              const isFromSingleChar = from.type === "Character";
518              if (isCharacter(from) && this.isRangeDash()) {
519                  this.consumeChar("-");
520                  const to = this.classAtom();
521                  const isToSingleChar = to.type === "Character";
522                  // a range can only be used when both sides are single characters
523                  if (isCharacter(to)) {
524                      if (to.value < from.value) {
525                          throw Error("Range out of order in character class");
526                      }
527                      set.push({ from: from.value, to: to.value });
528                  }
529                  else {
530                      // literal dash
531                      insertToSet(from.value, set);
532                      set.push(cc("-"));
533                      insertToSet(to.value, set);
534                  }
535              }
536              else {
537                  insertToSet(from.value, set);
538              }
539          }
540          this.consumeChar("]");
541          return { type: "Set", complement: complement, value: set };
542      }
543      classAtom() {
544          switch (this.peekChar()) {
545              // istanbul ignore next
546              case "]":
547              // istanbul ignore next
548              case "\n":
549              // istanbul ignore next
550              case "\r":
551              // istanbul ignore next
552              case "\u2028":
553              // istanbul ignore next
554              case "\u2029":
555                  throw Error("TBD");
556              case "\\":
557                  return this.classEscape();
558              default:
559                  return this.classPatternCharacterAtom();
560          }
561      }
562      classEscape() {
563          this.consumeChar("\\");
564          switch (this.peekChar()) {
565              // Matches a backspace.
566              // (Not to be confused with \b word boundary outside characterClass)
567              case "b":
568                  this.consumeChar("b");
569                  return { type: "Character", value: cc("\u0008") };
570              case "d":
571              case "D":
572              case "s":
573              case "S":
574              case "w":
575              case "W":
576                  return this.characterClassEscape();
577              case "f":
578              case "n":
579              case "r":
580              case "t":
581              case "v":
582                  return this.controlEscapeAtom();
583              case "c":
584                  return this.controlLetterEscapeAtom();
585              case "0":
586                  return this.nulCharacterAtom();
587              case "x":
588                  return this.hexEscapeSequenceAtom();
589              case "u":
590                  return this.regExpUnicodeEscapeSequenceAtom();
591              default:
592                  return this.identityEscapeAtom();
593          }
594      }
595      group() {
596          let capturing = true;
597          this.consumeChar("(");
598          switch (this.peekChar(0)) {
599              case "?":
600                  this.consumeChar("?");
601                  this.consumeChar(":");
602                  capturing = false;
603                  break;
604              default:
605                  this.groupIdx++;
606                  break;
607          }
608          const value = this.disjunction();
609          this.consumeChar(")");
610          const groupAst = {
611              type: "Group",
612              capturing: capturing,
613              value: value,
614          };
615          if (capturing) {
616              groupAst["idx"] = this.groupIdx;
617          }
618          return groupAst;
619      }
620      positiveInteger() {
621          let number = this.popChar();
622          // istanbul ignore next - can't ever get here due to previous lookahead checks
623          // still implementing this error checking in case this ever changes.
624          if (decimalPatternNoZero.test(number) === false) {
625              throw Error("Expecting a positive integer");
626          }
627          while (decimalPattern.test(this.peekChar(0))) {
628              number += this.popChar();
629          }
630          return parseInt(number, 10);
631      }
632      integerIncludingZero() {
633          let number = this.popChar();
634          if (decimalPattern.test(number) === false) {
635              throw Error("Expecting an integer");
636          }
637          while (decimalPattern.test(this.peekChar(0))) {
638              number += this.popChar();
639          }
640          return parseInt(number, 10);
641      }
642      patternCharacter() {
643          const nextChar = this.popChar();
644          switch (nextChar) {
645              // istanbul ignore next
646              case "\n":
647              // istanbul ignore next
648              case "\r":
649              // istanbul ignore next
650              case "\u2028":
651              // istanbul ignore next
652              case "\u2029":
653              // istanbul ignore next
654              case "^":
655              // istanbul ignore next
656              case "$":
657              // istanbul ignore next
658              case "\\":
659              // istanbul ignore next
660              case ".":
661              // istanbul ignore next
662              case "*":
663              // istanbul ignore next
664              case "+":
665              // istanbul ignore next
666              case "?":
667              // istanbul ignore next
668              case "(":
669              // istanbul ignore next
670              case ")":
671              // istanbul ignore next
672              case "[":
673              // istanbul ignore next
674              case "|":
675                  // istanbul ignore next
676                  throw Error("TBD");
677              default:
678                  return { type: "Character", value: cc(nextChar) };
679          }
680      }
681      isRegExpFlag() {
682          switch (this.peekChar(0)) {
683              case "g":
684              case "i":
685              case "m":
686              case "u":
687              case "y":
688                  return true;
689              default:
690                  return false;
691          }
692      }
693      isRangeDash() {
694          return this.peekChar() === "-" && this.isClassAtom(1);
695      }
696      isDigit() {
697          return decimalPattern.test(this.peekChar(0));
698      }
699      isClassAtom(howMuch = 0) {
700          switch (this.peekChar(howMuch)) {
701              case "]":
702              case "\n":
703              case "\r":
704              case "\u2028":
705              case "\u2029":
706                  return false;
707              default:
708                  return true;
709          }
710      }
711      isTerm() {
712          return this.isAtom() || this.isAssertion();
713      }
714      isAtom() {
715          if (this.isPatternCharacter()) {
716              return true;
717          }
718          switch (this.peekChar(0)) {
719              case ".":
720              case "\\": // atomEscape
721              case "[": // characterClass
722              // TODO: isAtom must be called before isAssertion - disambiguate
723              case "(": // group
724                  return true;
725              default:
726                  return false;
727          }
728      }
729      isAssertion() {
730          switch (this.peekChar(0)) {
731              case "^":
732              case "$":
733                  return true;
734              // '\b' or '\B'
735              case "\\":
736                  switch (this.peekChar(1)) {
737                      case "b":
738                      case "B":
739                          return true;
740                      default:
741                          return false;
742                  }
743              // '(?=' or '(?!'
744              case "(":
745                  return (this.peekChar(1) === "?" &&
746                      (this.peekChar(2) === "=" || this.peekChar(2) === "!"));
747              default:
748                  return false;
749          }
750      }
751      isQuantifier() {
752          const prevState = this.saveState();
753          try {
754              return this.quantifier(true) !== undefined;
755          }
756          catch (e) {
757              return false;
758          }
759          finally {
760              this.restoreState(prevState);
761          }
762      }
763      isPatternCharacter() {
764          switch (this.peekChar()) {
765              case "^":
766              case "$":
767              case "\\":
768              case ".":
769              case "*":
770              case "+":
771              case "?":
772              case "(":
773              case ")":
774              case "[":
775              case "|":
776              case "/":
777              case "\n":
778              case "\r":
779              case "\u2028":
780              case "\u2029":
781                  return false;
782              default:
783                  return true;
784          }
785      }
786      parseHexDigits(howMany) {
787          let hexString = "";
788          for (let i = 0; i < howMany; i++) {
789              const hexChar = this.popChar();
790              if (hexDigitPattern.test(hexChar) === false) {
791                  throw Error("Expecting a HexDecimal digits");
792              }
793              hexString += hexChar;
794          }
795          const charCode = parseInt(hexString, 16);
796          return { type: "Character", value: charCode };
797      }
798      peekChar(howMuch = 0) {
799          return this.input[this.idx + howMuch];
800      }
801      popChar() {
802          const nextChar = this.peekChar(0);
803          this.consumeChar(undefined);
804          return nextChar;
805      }
806      consumeChar(char) {
807          if (char !== undefined && this.input[this.idx] !== char) {
808              throw Error("Expected: '" +
809                  char +
810                  "' but found: '" +
811                  this.input[this.idx] +
812                  "' at offset: " +
813                  this.idx);
814          }
815          if (this.idx >= this.input.length) {
816              throw Error("Unexpected end of input");
817          }
818          this.idx++;
819      }
820      loc(begin) {
821          return { begin: begin, end: this.idx };
822      }
823  }
824  //# sourceMappingURL=regexp-parser.js.map
825  ;// CONCATENATED MODULE: ../node_modules/@chevrotain/regexp-to-ast/lib/src/base-regexp-visitor.js
826  class BaseRegExpVisitor {
827      visitChildren(node) {
828          for (const key in node) {
829              const child = node[key];
830              /* istanbul ignore else */
831              if (node.hasOwnProperty(key)) {
832                  if (child.type !== undefined) {
833                      this.visit(child);
834                  }
835                  else if (Array.isArray(child)) {
836                      child.forEach((subChild) => {
837                          this.visit(subChild);
838                      }, this);
839                  }
840              }
841          }
842      }
843      visit(node) {
844          switch (node.type) {
845              case "Pattern":
846                  this.visitPattern(node);
847                  break;
848              case "Flags":
849                  this.visitFlags(node);
850                  break;
851              case "Disjunction":
852                  this.visitDisjunction(node);
853                  break;
854              case "Alternative":
855                  this.visitAlternative(node);
856                  break;
857              case "StartAnchor":
858                  this.visitStartAnchor(node);
859                  break;
860              case "EndAnchor":
861                  this.visitEndAnchor(node);
862                  break;
863              case "WordBoundary":
864                  this.visitWordBoundary(node);
865                  break;
866              case "NonWordBoundary":
867                  this.visitNonWordBoundary(node);
868                  break;
869              case "Lookahead":
870                  this.visitLookahead(node);
871                  break;
872              case "NegativeLookahead":
873                  this.visitNegativeLookahead(node);
874                  break;
875              case "Character":
876                  this.visitCharacter(node);
877                  break;
878              case "Set":
879                  this.visitSet(node);
880                  break;
881              case "Group":
882                  this.visitGroup(node);
883                  break;
884              case "GroupBackReference":
885                  this.visitGroupBackReference(node);
886                  break;
887              case "Quantifier":
888                  this.visitQuantifier(node);
889                  break;
890          }
891          this.visitChildren(node);
892      }
893      visitPattern(node) { }
894      visitFlags(node) { }
895      visitDisjunction(node) { }
896      visitAlternative(node) { }
897      // Assertion
898      visitStartAnchor(node) { }
899      visitEndAnchor(node) { }
900      visitWordBoundary(node) { }
901      visitNonWordBoundary(node) { }
902      visitLookahead(node) { }
903      visitNegativeLookahead(node) { }
904      // atoms
905      visitCharacter(node) { }
906      visitSet(node) { }
907      visitGroup(node) { }
908      visitGroupBackReference(node) { }
909      visitQuantifier(node) { }
910  }
911  //# sourceMappingURL=base-regexp-visitor.js.map
912  ;// CONCATENATED MODULE: ../node_modules/@chevrotain/regexp-to-ast/lib/src/api.js
913  
914  
915  //# sourceMappingURL=api.js.map
916  
917  /***/ }),
918  
919  /***/ 20078:
920  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
921  
922  "use strict";
923  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
924  /* harmony export */   z: () => (/* binding */ createGitGraphServices)
925  /* harmony export */ });
926  /* unused harmony export GitGraphModule */
927  /* harmony import */ var _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60960);
928  /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44014);
929  /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81210);
930  /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(73001);
931  
932  
933  // src/language/gitGraph/module.ts
934  
935  
936  // src/language/gitGraph/tokenBuilder.ts
937  var GitGraphTokenBuilder = class extends _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .AbstractMermaidTokenBuilder */ .T7 {
938    static {
939      (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(this, "GitGraphTokenBuilder");
940    }
941    constructor() {
942      super(["gitGraph"]);
943    }
944  };
945  
946  // src/language/gitGraph/module.ts
947  var GitGraphModule = {
948    parser: {
949      TokenBuilder: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new GitGraphTokenBuilder(), "TokenBuilder"),
950      ValueConverter: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .CommonValueConverter */ .nr(), "ValueConverter")
951    }
952  };
953  function createGitGraphServices(context = langium__WEBPACK_IMPORTED_MODULE_1__/* .EmptyFileSystem */ .u) {
954    const shared = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
955      (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultSharedCoreModule */ .T)(context),
956      _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .MermaidGeneratedSharedModule */ .GS
957    );
958    const GitGraph = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
959      (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultCoreModule */ .Q)({ shared }),
960      _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .GitGraphGeneratedModule */ .vn,
961      GitGraphModule
962    );
963    shared.ServiceRegistry.register(GitGraph);
964    return { shared, GitGraph };
965  }
966  (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(createGitGraphServices, "createGitGraphServices");
967  
968  
969  
970  
971  /***/ }),
972  
973  /***/ 51991:
974  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
975  
976  "use strict";
977  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
978  /* harmony export */   T: () => (/* binding */ createRadarServices)
979  /* harmony export */ });
980  /* unused harmony export RadarModule */
981  /* harmony import */ var _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60960);
982  /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44014);
983  /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81210);
984  /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(73001);
985  
986  
987  // src/language/radar/module.ts
988  
989  
990  // src/language/radar/tokenBuilder.ts
991  var RadarTokenBuilder = class extends _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .AbstractMermaidTokenBuilder */ .T7 {
992    static {
993      (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(this, "RadarTokenBuilder");
994    }
995    constructor() {
996      super(["radar-beta"]);
997    }
998  };
999  
1000 // src/language/radar/module.ts
1001 var RadarModule = {
1002   parser: {
1003     TokenBuilder: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new RadarTokenBuilder(), "TokenBuilder"),
1004     ValueConverter: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .CommonValueConverter */ .nr(), "ValueConverter")
1005   }
1006 };
1007 function createRadarServices(context = langium__WEBPACK_IMPORTED_MODULE_1__/* .EmptyFileSystem */ .u) {
1008   const shared = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
1009     (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultSharedCoreModule */ .T)(context),
1010     _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .MermaidGeneratedSharedModule */ .GS
1011   );
1012   const Radar = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
1013     (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultCoreModule */ .Q)({ shared }),
1014     _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .RadarGeneratedModule */ .gB,
1015     RadarModule
1016   );
1017   shared.ServiceRegistry.register(Radar);
1018   return { shared, Radar };
1019 }
1020 (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(createRadarServices, "createRadarServices");
1021 
1022 
1023 
1024 
1025 /***/ }),
1026 
1027 /***/ 60960:
1028 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1029 
1030 "use strict";
1031 
1032 // EXPORTS
1033 __webpack_require__.d(__webpack_exports__, {
1034   T7: () => (/* binding */ AbstractMermaidTokenBuilder),
1035   kb: () => (/* binding */ AbstractMermaidValueConverter),
1036   Qr: () => (/* binding */ ArchitectureGeneratedModule),
1037   nr: () => (/* binding */ CommonValueConverter),
1038   vn: () => (/* binding */ GitGraphGeneratedModule),
1039   F_: () => (/* binding */ InfoGeneratedModule),
1040   GS: () => (/* binding */ MermaidGeneratedSharedModule),
1041   bb: () => (/* binding */ PacketGeneratedModule),
1042   WH: () => (/* binding */ PieGeneratedModule),
1043   gB: () => (/* binding */ RadarGeneratedModule),
1044   eW: () => (/* binding */ __name)
1045 });
1046 
1047 // UNUSED EXPORTS: Architecture, Branch, Commit, CommonTokenBuilder, GitGraph, Info, Merge, Packet, PacketBlock, Pie, PieSection, Radar, Statement, isArchitecture, isBranch, isCommit, isCommon, isGitGraph, isInfo, isMerge, isPacket, isPacketBlock, isPie, isPieSection
1048 
1049 // EXTERNAL MODULE: ../node_modules/langium/lib/syntax-tree.js
1050 var syntax_tree = __webpack_require__(91303);
1051 // EXTERNAL MODULE: ../node_modules/langium/lib/default-module.js + 42 modules
1052 var default_module = __webpack_require__(73001);
1053 // EXTERNAL MODULE: ../node_modules/langium/lib/dependency-injection.js
1054 var dependency_injection = __webpack_require__(81210);
1055 // EXTERNAL MODULE: ../node_modules/langium/lib/languages/generated/ast.js
1056 var ast = __webpack_require__(34905);
1057 // EXTERNAL MODULE: ../node_modules/langium/lib/workspace/file-system-provider.js
1058 var file_system_provider = __webpack_require__(44014);
1059 // EXTERNAL MODULE: ../node_modules/vscode-uri/lib/esm/index.mjs
1060 var esm = __webpack_require__(37943);
1061 ;// CONCATENATED MODULE: ../node_modules/langium/lib/utils/grammar-loader.js
1062 /******************************************************************************
1063  * Copyright 2023 TypeFox GmbH
1064  * This program and the accompanying materials are made available under the
1065  * terms of the MIT License, which is available in the project root.
1066  ******************************************************************************/
1067 
1068 
1069 
1070 
1071 
1072 const minimalGrammarModule = {
1073     Grammar: () => undefined,
1074     LanguageMetaData: () => ({
1075         caseInsensitive: false,
1076         fileExtensions: ['.langium'],
1077         languageId: 'langium'
1078     })
1079 };
1080 const minimalSharedGrammarModule = {
1081     AstReflection: () => new ast/* LangiumGrammarAstReflection */.SV()
1082 };
1083 function createMinimalGrammarServices() {
1084     const shared = (0,dependency_injection/* inject */.f3)((0,default_module/* createDefaultSharedCoreModule */.T)(file_system_provider/* EmptyFileSystem */.u), minimalSharedGrammarModule);
1085     const grammar = (0,dependency_injection/* inject */.f3)((0,default_module/* createDefaultCoreModule */.Q)({ shared }), minimalGrammarModule);
1086     shared.ServiceRegistry.register(grammar);
1087     return grammar;
1088 }
1089 /**
1090  * Load a Langium grammar for your language from a JSON string. This is used by several services,
1091  * most notably the parser builder which interprets the grammar to create a parser.
1092  */
1093 function loadGrammarFromJson(json) {
1094     var _a;
1095     const services = createMinimalGrammarServices();
1096     const astNode = services.serializer.JsonSerializer.deserialize(json);
1097     services.shared.workspace.LangiumDocumentFactory.fromModel(astNode, esm/* URI */.o.parse(`memory://${(_a = astNode.name) !== null && _a !== void 0 ? _a : 'grammar'}.langium`));
1098     return astNode;
1099 }
1100 //# sourceMappingURL=grammar-loader.js.map
1101 // EXTERNAL MODULE: ../node_modules/langium/lib/parser/value-converter.js
1102 var value_converter = __webpack_require__(46174);
1103 // EXTERNAL MODULE: ../node_modules/langium/lib/parser/token-builder.js
1104 var token_builder = __webpack_require__(35481);
1105 ;// CONCATENATED MODULE: ../node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-7PKI6E2E.mjs
1106 var __defProp = Object.defineProperty;
1107 var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1108 
1109 // src/language/generated/ast.ts
1110 
1111 var Statement = "Statement";
1112 var Architecture = "Architecture";
1113 function isArchitecture(item) {
1114   return reflection.isInstance(item, Architecture);
1115 }
1116 __name(isArchitecture, "isArchitecture");
1117 var Axis = "Axis";
1118 var Branch = "Branch";
1119 function isBranch(item) {
1120   return reflection.isInstance(item, Branch);
1121 }
1122 __name(isBranch, "isBranch");
1123 var Checkout = "Checkout";
1124 var CherryPicking = "CherryPicking";
1125 var Commit = "Commit";
1126 function isCommit(item) {
1127   return reflection.isInstance(item, Commit);
1128 }
1129 __name(isCommit, "isCommit");
1130 var Common = "Common";
1131 function isCommon(item) {
1132   return reflection.isInstance(item, Common);
1133 }
1134 __name(isCommon, "isCommon");
1135 var Curve = "Curve";
1136 var Edge = "Edge";
1137 var Entry = "Entry";
1138 var GitGraph = "GitGraph";
1139 function isGitGraph(item) {
1140   return reflection.isInstance(item, GitGraph);
1141 }
1142 __name(isGitGraph, "isGitGraph");
1143 var Group = "Group";
1144 var Info = "Info";
1145 function isInfo(item) {
1146   return reflection.isInstance(item, Info);
1147 }
1148 __name(isInfo, "isInfo");
1149 var Junction = "Junction";
1150 var Merge = "Merge";
1151 function isMerge(item) {
1152   return reflection.isInstance(item, Merge);
1153 }
1154 __name(isMerge, "isMerge");
1155 var Option = "Option";
1156 var Packet = "Packet";
1157 function isPacket(item) {
1158   return reflection.isInstance(item, Packet);
1159 }
1160 __name(isPacket, "isPacket");
1161 var PacketBlock = "PacketBlock";
1162 function isPacketBlock(item) {
1163   return reflection.isInstance(item, PacketBlock);
1164 }
1165 __name(isPacketBlock, "isPacketBlock");
1166 var Pie = "Pie";
1167 function isPie(item) {
1168   return reflection.isInstance(item, Pie);
1169 }
1170 __name(isPie, "isPie");
1171 var PieSection = "PieSection";
1172 function isPieSection(item) {
1173   return reflection.isInstance(item, PieSection);
1174 }
1175 __name(isPieSection, "isPieSection");
1176 var Radar = "Radar";
1177 var Service = "Service";
1178 var Direction = "Direction";
1179 var MermaidAstReflection = class extends syntax_tree/* AbstractAstReflection */.$v {
1180   static {
1181     __name(this, "MermaidAstReflection");
1182   }
1183   getAllTypes() {
1184     return [Architecture, Axis, Branch, Checkout, CherryPicking, Commit, Common, Curve, Direction, Edge, Entry, GitGraph, Group, Info, Junction, Merge, Option, Packet, PacketBlock, Pie, PieSection, Radar, Service, Statement];
1185   }
1186   computeIsSubtype(subtype, supertype) {
1187     switch (subtype) {
1188       case Branch:
1189       case Checkout:
1190       case CherryPicking:
1191       case Commit:
1192       case Merge: {
1193         return this.isSubtype(Statement, supertype);
1194       }
1195       case Direction: {
1196         return this.isSubtype(GitGraph, supertype);
1197       }
1198       default: {
1199         return false;
1200       }
1201     }
1202   }
1203   getReferenceType(refInfo) {
1204     const referenceId = `${refInfo.container.$type}:${refInfo.property}`;
1205     switch (referenceId) {
1206       case "Entry:axis": {
1207         return Axis;
1208       }
1209       default: {
1210         throw new Error(`${referenceId} is not a valid reference id.`);
1211       }
1212     }
1213   }
1214   getTypeMetaData(type) {
1215     switch (type) {
1216       case Architecture: {
1217         return {
1218           name: Architecture,
1219           properties: [
1220             { name: "accDescr" },
1221             { name: "accTitle" },
1222             { name: "edges", defaultValue: [] },
1223             { name: "groups", defaultValue: [] },
1224             { name: "junctions", defaultValue: [] },
1225             { name: "services", defaultValue: [] },
1226             { name: "title" }
1227           ]
1228         };
1229       }
1230       case Axis: {
1231         return {
1232           name: Axis,
1233           properties: [
1234             { name: "label" },
1235             { name: "name" }
1236           ]
1237         };
1238       }
1239       case Branch: {
1240         return {
1241           name: Branch,
1242           properties: [
1243             { name: "name" },
1244             { name: "order" }
1245           ]
1246         };
1247       }
1248       case Checkout: {
1249         return {
1250           name: Checkout,
1251           properties: [
1252             { name: "branch" }
1253           ]
1254         };
1255       }
1256       case CherryPicking: {
1257         return {
1258           name: CherryPicking,
1259           properties: [
1260             { name: "id" },
1261             { name: "parent" },
1262             { name: "tags", defaultValue: [] }
1263           ]
1264         };
1265       }
1266       case Commit: {
1267         return {
1268           name: Commit,
1269           properties: [
1270             { name: "id" },
1271             { name: "message" },
1272             { name: "tags", defaultValue: [] },
1273             { name: "type" }
1274           ]
1275         };
1276       }
1277       case Common: {
1278         return {
1279           name: Common,
1280           properties: [
1281             { name: "accDescr" },
1282             { name: "accTitle" },
1283             { name: "title" }
1284           ]
1285         };
1286       }
1287       case Curve: {
1288         return {
1289           name: Curve,
1290           properties: [
1291             { name: "entries", defaultValue: [] },
1292             { name: "label" },
1293             { name: "name" }
1294           ]
1295         };
1296       }
1297       case Edge: {
1298         return {
1299           name: Edge,
1300           properties: [
1301             { name: "lhsDir" },
1302             { name: "lhsGroup", defaultValue: false },
1303             { name: "lhsId" },
1304             { name: "lhsInto", defaultValue: false },
1305             { name: "rhsDir" },
1306             { name: "rhsGroup", defaultValue: false },
1307             { name: "rhsId" },
1308             { name: "rhsInto", defaultValue: false },
1309             { name: "title" }
1310           ]
1311         };
1312       }
1313       case Entry: {
1314         return {
1315           name: Entry,
1316           properties: [
1317             { name: "axis" },
1318             { name: "value" }
1319           ]
1320         };
1321       }
1322       case GitGraph: {
1323         return {
1324           name: GitGraph,
1325           properties: [
1326             { name: "accDescr" },
1327             { name: "accTitle" },
1328             { name: "statements", defaultValue: [] },
1329             { name: "title" }
1330           ]
1331         };
1332       }
1333       case Group: {
1334         return {
1335           name: Group,
1336           properties: [
1337             { name: "icon" },
1338             { name: "id" },
1339             { name: "in" },
1340             { name: "title" }
1341           ]
1342         };
1343       }
1344       case Info: {
1345         return {
1346           name: Info,
1347           properties: [
1348             { name: "accDescr" },
1349             { name: "accTitle" },
1350             { name: "title" }
1351           ]
1352         };
1353       }
1354       case Junction: {
1355         return {
1356           name: Junction,
1357           properties: [
1358             { name: "id" },
1359             { name: "in" }
1360           ]
1361         };
1362       }
1363       case Merge: {
1364         return {
1365           name: Merge,
1366           properties: [
1367             { name: "branch" },
1368             { name: "id" },
1369             { name: "tags", defaultValue: [] },
1370             { name: "type" }
1371           ]
1372         };
1373       }
1374       case Option: {
1375         return {
1376           name: Option,
1377           properties: [
1378             { name: "name" },
1379             { name: "value", defaultValue: false }
1380           ]
1381         };
1382       }
1383       case Packet: {
1384         return {
1385           name: Packet,
1386           properties: [
1387             { name: "accDescr" },
1388             { name: "accTitle" },
1389             { name: "blocks", defaultValue: [] },
1390             { name: "title" }
1391           ]
1392         };
1393       }
1394       case PacketBlock: {
1395         return {
1396           name: PacketBlock,
1397           properties: [
1398             { name: "end" },
1399             { name: "label" },
1400             { name: "start" }
1401           ]
1402         };
1403       }
1404       case Pie: {
1405         return {
1406           name: Pie,
1407           properties: [
1408             { name: "accDescr" },
1409             { name: "accTitle" },
1410             { name: "sections", defaultValue: [] },
1411             { name: "showData", defaultValue: false },
1412             { name: "title" }
1413           ]
1414         };
1415       }
1416       case PieSection: {
1417         return {
1418           name: PieSection,
1419           properties: [
1420             { name: "label" },
1421             { name: "value" }
1422           ]
1423         };
1424       }
1425       case Radar: {
1426         return {
1427           name: Radar,
1428           properties: [
1429             { name: "accDescr" },
1430             { name: "accTitle" },
1431             { name: "axes", defaultValue: [] },
1432             { name: "curves", defaultValue: [] },
1433             { name: "options", defaultValue: [] },
1434             { name: "title" }
1435           ]
1436         };
1437       }
1438       case Service: {
1439         return {
1440           name: Service,
1441           properties: [
1442             { name: "icon" },
1443             { name: "iconText" },
1444             { name: "id" },
1445             { name: "in" },
1446             { name: "title" }
1447           ]
1448         };
1449       }
1450       case Direction: {
1451         return {
1452           name: Direction,
1453           properties: [
1454             { name: "accDescr" },
1455             { name: "accTitle" },
1456             { name: "dir" },
1457             { name: "statements", defaultValue: [] },
1458             { name: "title" }
1459           ]
1460         };
1461       }
1462       default: {
1463         return {
1464           name: type,
1465           properties: []
1466         };
1467       }
1468     }
1469   }
1470 };
1471 var reflection = new MermaidAstReflection();
1472 
1473 // src/language/generated/grammar.ts
1474 
1475 var loadedInfoGrammar;
1476 var InfoGrammar = /* @__PURE__ */ __name(() => loadedInfoGrammar ?? (loadedInfoGrammar = loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')), "InfoGrammar");
1477 var loadedPacketGrammar;
1478 var PacketGrammar = /* @__PURE__ */ __name(() => loadedPacketGrammar ?? (loadedPacketGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"packet-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}`)), "PacketGrammar");
1479 var loadedPieGrammar;
1480 var PieGrammar = /* @__PURE__ */ __name(() => loadedPieGrammar ?? (loadedPieGrammar = loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"PIE_SECTION_LABEL","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]+\\"/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PIE_SECTION_VALUE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')), "PieGrammar");
1481 var loadedArchitectureGrammar;
1482 var ArchitectureGrammar = /* @__PURE__ */ __name(() => loadedArchitectureGrammar ?? (loadedArchitectureGrammar = loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ID","definition":{"$type":"RegexToken","regex":"/[\\\\w]+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TEXT_ICON","definition":{"$type":"RegexToken","regex":"/\\\\(\\"[^\\"]+\\"\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/"},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')), "ArchitectureGrammar");
1483 var loadedGitGraphGrammar;
1484 var GitGraphGrammar = /* @__PURE__ */ __name(() => loadedGitGraphGrammar ?? (loadedGitGraphGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"GitGraph","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+(?=\\\\s)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}`)), "GitGraphGrammar");
1485 var loadedRadarGrammar;
1486 var RadarGrammar = /* @__PURE__ */ __name(() => loadedRadarGrammar ?? (loadedRadarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"Radar","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@12"}}}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@12"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9\\\\-_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}`)), "RadarGrammar");
1487 
1488 // src/language/generated/module.ts
1489 var InfoLanguageMetaData = {
1490   languageId: "info",
1491   fileExtensions: [".mmd", ".mermaid"],
1492   caseInsensitive: false,
1493   mode: "production"
1494 };
1495 var PacketLanguageMetaData = {
1496   languageId: "packet",
1497   fileExtensions: [".mmd", ".mermaid"],
1498   caseInsensitive: false,
1499   mode: "production"
1500 };
1501 var PieLanguageMetaData = {
1502   languageId: "pie",
1503   fileExtensions: [".mmd", ".mermaid"],
1504   caseInsensitive: false,
1505   mode: "production"
1506 };
1507 var ArchitectureLanguageMetaData = {
1508   languageId: "architecture",
1509   fileExtensions: [".mmd", ".mermaid"],
1510   caseInsensitive: false,
1511   mode: "production"
1512 };
1513 var GitGraphLanguageMetaData = {
1514   languageId: "gitGraph",
1515   fileExtensions: [".mmd", ".mermaid"],
1516   caseInsensitive: false,
1517   mode: "production"
1518 };
1519 var RadarLanguageMetaData = {
1520   languageId: "radar",
1521   fileExtensions: [".mmd", ".mermaid"],
1522   caseInsensitive: false,
1523   mode: "production"
1524 };
1525 var MermaidGeneratedSharedModule = {
1526   AstReflection: /* @__PURE__ */ __name(() => new MermaidAstReflection(), "AstReflection")
1527 };
1528 var InfoGeneratedModule = {
1529   Grammar: /* @__PURE__ */ __name(() => InfoGrammar(), "Grammar"),
1530   LanguageMetaData: /* @__PURE__ */ __name(() => InfoLanguageMetaData, "LanguageMetaData"),
1531   parser: {}
1532 };
1533 var PacketGeneratedModule = {
1534   Grammar: /* @__PURE__ */ __name(() => PacketGrammar(), "Grammar"),
1535   LanguageMetaData: /* @__PURE__ */ __name(() => PacketLanguageMetaData, "LanguageMetaData"),
1536   parser: {}
1537 };
1538 var PieGeneratedModule = {
1539   Grammar: /* @__PURE__ */ __name(() => PieGrammar(), "Grammar"),
1540   LanguageMetaData: /* @__PURE__ */ __name(() => PieLanguageMetaData, "LanguageMetaData"),
1541   parser: {}
1542 };
1543 var ArchitectureGeneratedModule = {
1544   Grammar: /* @__PURE__ */ __name(() => ArchitectureGrammar(), "Grammar"),
1545   LanguageMetaData: /* @__PURE__ */ __name(() => ArchitectureLanguageMetaData, "LanguageMetaData"),
1546   parser: {}
1547 };
1548 var GitGraphGeneratedModule = {
1549   Grammar: /* @__PURE__ */ __name(() => GitGraphGrammar(), "Grammar"),
1550   LanguageMetaData: /* @__PURE__ */ __name(() => GitGraphLanguageMetaData, "LanguageMetaData"),
1551   parser: {}
1552 };
1553 var RadarGeneratedModule = {
1554   Grammar: /* @__PURE__ */ __name(() => RadarGrammar(), "Grammar"),
1555   LanguageMetaData: /* @__PURE__ */ __name(() => RadarLanguageMetaData, "LanguageMetaData"),
1556   parser: {}
1557 };
1558 
1559 // src/language/common/valueConverter.ts
1560 
1561 
1562 // src/language/common/matcher.ts
1563 var accessibilityDescrRegex = /accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/;
1564 var accessibilityTitleRegex = /accTitle[\t ]*:([^\n\r]*)/;
1565 var titleRegex = /title([\t ][^\n\r]*|)/;
1566 
1567 // src/language/common/valueConverter.ts
1568 var rulesRegexes = {
1569   ACC_DESCR: accessibilityDescrRegex,
1570   ACC_TITLE: accessibilityTitleRegex,
1571   TITLE: titleRegex
1572 };
1573 var AbstractMermaidValueConverter = class extends value_converter/* DefaultValueConverter */.t {
1574   static {
1575     __name(this, "AbstractMermaidValueConverter");
1576   }
1577   runConverter(rule, input, cstNode) {
1578     let value = this.runCommonConverter(rule, input, cstNode);
1579     if (value === void 0) {
1580       value = this.runCustomConverter(rule, input, cstNode);
1581     }
1582     if (value === void 0) {
1583       return super.runConverter(rule, input, cstNode);
1584     }
1585     return value;
1586   }
1587   runCommonConverter(rule, input, _cstNode) {
1588     const regex = rulesRegexes[rule.name];
1589     if (regex === void 0) {
1590       return void 0;
1591     }
1592     const match = regex.exec(input);
1593     if (match === null) {
1594       return void 0;
1595     }
1596     if (match[1] !== void 0) {
1597       return match[1].trim().replace(/[\t ]{2,}/gm, " ");
1598     }
1599     if (match[2] !== void 0) {
1600       return match[2].replace(/^\s*/gm, "").replace(/\s+$/gm, "").replace(/[\t ]{2,}/gm, " ").replace(/[\n\r]{2,}/gm, "\n");
1601     }
1602     return void 0;
1603   }
1604 };
1605 var CommonValueConverter = class extends AbstractMermaidValueConverter {
1606   static {
1607     __name(this, "CommonValueConverter");
1608   }
1609   runCustomConverter(_rule, _input, _cstNode) {
1610     return void 0;
1611   }
1612 };
1613 
1614 // src/language/common/tokenBuilder.ts
1615 
1616 var AbstractMermaidTokenBuilder = class extends token_builder/* DefaultTokenBuilder */.P {
1617   static {
1618     __name(this, "AbstractMermaidTokenBuilder");
1619   }
1620   constructor(keywords) {
1621     super();
1622     this.keywords = new Set(keywords);
1623   }
1624   buildKeywordTokens(rules, terminalTokens, options) {
1625     const tokenTypes = super.buildKeywordTokens(rules, terminalTokens, options);
1626     tokenTypes.forEach((tokenType) => {
1627       if (this.keywords.has(tokenType.name) && tokenType.PATTERN !== void 0) {
1628         tokenType.PATTERN = new RegExp(tokenType.PATTERN.toString() + "(?:(?=%%)|(?!\\S))");
1629       }
1630     });
1631     return tokenTypes;
1632   }
1633 };
1634 var CommonTokenBuilder = class extends AbstractMermaidTokenBuilder {
1635   static {
1636     __name(this, "CommonTokenBuilder");
1637   }
1638 };
1639 
1640 
1641 
1642 
1643 /***/ }),
1644 
1645 /***/ 95626:
1646 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1647 
1648 "use strict";
1649 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1650 /* harmony export */   i: () => (/* binding */ createArchitectureServices)
1651 /* harmony export */ });
1652 /* unused harmony export ArchitectureModule */
1653 /* harmony import */ var _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60960);
1654 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44014);
1655 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81210);
1656 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(73001);
1657 
1658 
1659 // src/language/architecture/module.ts
1660 
1661 
1662 // src/language/architecture/tokenBuilder.ts
1663 var ArchitectureTokenBuilder = class extends _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .AbstractMermaidTokenBuilder */ .T7 {
1664   static {
1665     (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(this, "ArchitectureTokenBuilder");
1666   }
1667   constructor() {
1668     super(["architecture"]);
1669   }
1670 };
1671 
1672 // src/language/architecture/valueConverter.ts
1673 var ArchitectureValueConverter = class extends _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .AbstractMermaidValueConverter */ .kb {
1674   static {
1675     (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(this, "ArchitectureValueConverter");
1676   }
1677   runCustomConverter(rule, input, _cstNode) {
1678     if (rule.name === "ARCH_ICON") {
1679       return input.replace(/[()]/g, "").trim();
1680     } else if (rule.name === "ARCH_TEXT_ICON") {
1681       return input.replace(/["()]/g, "");
1682     } else if (rule.name === "ARCH_TITLE") {
1683       return input.replace(/[[\]]/g, "").trim();
1684     }
1685     return void 0;
1686   }
1687 };
1688 
1689 // src/language/architecture/module.ts
1690 var ArchitectureModule = {
1691   parser: {
1692     TokenBuilder: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new ArchitectureTokenBuilder(), "TokenBuilder"),
1693     ValueConverter: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new ArchitectureValueConverter(), "ValueConverter")
1694   }
1695 };
1696 function createArchitectureServices(context = langium__WEBPACK_IMPORTED_MODULE_1__/* .EmptyFileSystem */ .u) {
1697   const shared = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
1698     (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultSharedCoreModule */ .T)(context),
1699     _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .MermaidGeneratedSharedModule */ .GS
1700   );
1701   const Architecture = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
1702     (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultCoreModule */ .Q)({ shared }),
1703     _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .ArchitectureGeneratedModule */ .Qr,
1704     ArchitectureModule
1705   );
1706   shared.ServiceRegistry.register(Architecture);
1707   return { shared, Architecture };
1708 }
1709 (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(createArchitectureServices, "createArchitectureServices");
1710 
1711 
1712 
1713 
1714 /***/ }),
1715 
1716 /***/ 63809:
1717 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1718 
1719 "use strict";
1720 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1721 /* harmony export */   M: () => (/* binding */ createInfoServices)
1722 /* harmony export */ });
1723 /* unused harmony export InfoModule */
1724 /* harmony import */ var _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60960);
1725 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44014);
1726 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81210);
1727 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(73001);
1728 
1729 
1730 // src/language/info/module.ts
1731 
1732 
1733 // src/language/info/tokenBuilder.ts
1734 var InfoTokenBuilder = class extends _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .AbstractMermaidTokenBuilder */ .T7 {
1735   static {
1736     (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(this, "InfoTokenBuilder");
1737   }
1738   constructor() {
1739     super(["info", "showInfo"]);
1740   }
1741 };
1742 
1743 // src/language/info/module.ts
1744 var InfoModule = {
1745   parser: {
1746     TokenBuilder: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new InfoTokenBuilder(), "TokenBuilder"),
1747     ValueConverter: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .CommonValueConverter */ .nr(), "ValueConverter")
1748   }
1749 };
1750 function createInfoServices(context = langium__WEBPACK_IMPORTED_MODULE_1__/* .EmptyFileSystem */ .u) {
1751   const shared = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
1752     (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultSharedCoreModule */ .T)(context),
1753     _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .MermaidGeneratedSharedModule */ .GS
1754   );
1755   const Info = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
1756     (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultCoreModule */ .Q)({ shared }),
1757     _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .InfoGeneratedModule */ .F_,
1758     InfoModule
1759   );
1760   shared.ServiceRegistry.register(Info);
1761   return { shared, Info };
1762 }
1763 (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(createInfoServices, "createInfoServices");
1764 
1765 
1766 
1767 
1768 /***/ }),
1769 
1770 /***/ 76150:
1771 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1772 
1773 "use strict";
1774 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1775 /* harmony export */   l: () => (/* binding */ createPieServices)
1776 /* harmony export */ });
1777 /* unused harmony export PieModule */
1778 /* harmony import */ var _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60960);
1779 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44014);
1780 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81210);
1781 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(73001);
1782 
1783 
1784 // src/language/pie/module.ts
1785 
1786 
1787 // src/language/pie/tokenBuilder.ts
1788 var PieTokenBuilder = class extends _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .AbstractMermaidTokenBuilder */ .T7 {
1789   static {
1790     (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(this, "PieTokenBuilder");
1791   }
1792   constructor() {
1793     super(["pie", "showData"]);
1794   }
1795 };
1796 
1797 // src/language/pie/valueConverter.ts
1798 var PieValueConverter = class extends _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .AbstractMermaidValueConverter */ .kb {
1799   static {
1800     (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(this, "PieValueConverter");
1801   }
1802   runCustomConverter(rule, input, _cstNode) {
1803     if (rule.name !== "PIE_SECTION_LABEL") {
1804       return void 0;
1805     }
1806     return input.replace(/"/g, "").trim();
1807   }
1808 };
1809 
1810 // src/language/pie/module.ts
1811 var PieModule = {
1812   parser: {
1813     TokenBuilder: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new PieTokenBuilder(), "TokenBuilder"),
1814     ValueConverter: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new PieValueConverter(), "ValueConverter")
1815   }
1816 };
1817 function createPieServices(context = langium__WEBPACK_IMPORTED_MODULE_1__/* .EmptyFileSystem */ .u) {
1818   const shared = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
1819     (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultSharedCoreModule */ .T)(context),
1820     _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .MermaidGeneratedSharedModule */ .GS
1821   );
1822   const Pie = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
1823     (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultCoreModule */ .Q)({ shared }),
1824     _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .PieGeneratedModule */ .WH,
1825     PieModule
1826   );
1827   shared.ServiceRegistry.register(Pie);
1828   return { shared, Pie };
1829 }
1830 (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(createPieServices, "createPieServices");
1831 
1832 
1833 
1834 
1835 /***/ }),
1836 
1837 /***/ 89053:
1838 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1839 
1840 "use strict";
1841 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1842 /* harmony export */   g: () => (/* binding */ createPacketServices)
1843 /* harmony export */ });
1844 /* unused harmony export PacketModule */
1845 /* harmony import */ var _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60960);
1846 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(44014);
1847 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81210);
1848 /* harmony import */ var langium__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(73001);
1849 
1850 
1851 // src/language/packet/module.ts
1852 
1853 
1854 // src/language/packet/tokenBuilder.ts
1855 var PacketTokenBuilder = class extends _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .AbstractMermaidTokenBuilder */ .T7 {
1856   static {
1857     (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(this, "PacketTokenBuilder");
1858   }
1859   constructor() {
1860     super(["packet-beta"]);
1861   }
1862 };
1863 
1864 // src/language/packet/module.ts
1865 var PacketModule = {
1866   parser: {
1867     TokenBuilder: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new PacketTokenBuilder(), "TokenBuilder"),
1868     ValueConverter: /* @__PURE__ */ (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(() => new _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .CommonValueConverter */ .nr(), "ValueConverter")
1869   }
1870 };
1871 function createPacketServices(context = langium__WEBPACK_IMPORTED_MODULE_1__/* .EmptyFileSystem */ .u) {
1872   const shared = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
1873     (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultSharedCoreModule */ .T)(context),
1874     _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .MermaidGeneratedSharedModule */ .GS
1875   );
1876   const Packet = (0,langium__WEBPACK_IMPORTED_MODULE_2__/* .inject */ .f3)(
1877     (0,langium__WEBPACK_IMPORTED_MODULE_3__/* .createDefaultCoreModule */ .Q)({ shared }),
1878     _chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .PacketGeneratedModule */ .bb,
1879     PacketModule
1880   );
1881   shared.ServiceRegistry.register(Packet);
1882   return { shared, Packet };
1883 }
1884 (0,_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .eW)(createPacketServices, "createPacketServices");
1885 
1886 
1887 
1888 
1889 /***/ }),
1890 
1891 /***/ 13197:
1892 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1893 
1894 "use strict";
1895 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1896 /* harmony export */   Qc: () => (/* binding */ parse)
1897 /* harmony export */ });
1898 /* unused harmony export MermaidParseError */
1899 /* harmony import */ var _chunks_mermaid_parser_core_chunk_2NYFTIL2_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20078);
1900 /* harmony import */ var _chunks_mermaid_parser_core_chunk_EXZZNE6F_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(63809);
1901 /* harmony import */ var _chunks_mermaid_parser_core_chunk_V4Q32G6S_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(89053);
1902 /* harmony import */ var _chunks_mermaid_parser_core_chunk_ROXG7S4E_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(76150);
1903 /* harmony import */ var _chunks_mermaid_parser_core_chunk_C4OEIS7N_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(95626);
1904 /* harmony import */ var _chunks_mermaid_parser_core_chunk_2O5ZK7RR_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(51991);
1905 /* harmony import */ var _chunks_mermaid_parser_core_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(60960);
1906 
1907 
1908 
1909 
1910 
1911 
1912 
1913 
1914 // src/parse.ts
1915 var parsers = {};
1916 var initializers = {
1917   info: /* @__PURE__ */ (0,_chunks_mermaid_parser_core_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_6__/* .__name */ .eW)(async () => {
1918     const { createInfoServices: createInfoServices2 } = await __webpack_require__.e(/* import() */ 4828).then(__webpack_require__.bind(__webpack_require__, 14828));
1919     const parser = createInfoServices2().Info.parser.LangiumParser;
1920     parsers.info = parser;
1921   }, "info"),
1922   packet: /* @__PURE__ */ (0,_chunks_mermaid_parser_core_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_6__/* .__name */ .eW)(async () => {
1923     const { createPacketServices: createPacketServices2 } = await __webpack_require__.e(/* import() */ 339).then(__webpack_require__.bind(__webpack_require__, 90339));
1924     const parser = createPacketServices2().Packet.parser.LangiumParser;
1925     parsers.packet = parser;
1926   }, "packet"),
1927   pie: /* @__PURE__ */ (0,_chunks_mermaid_parser_core_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_6__/* .__name */ .eW)(async () => {
1928     const { createPieServices: createPieServices2 } = await __webpack_require__.e(/* import() */ 6561).then(__webpack_require__.bind(__webpack_require__, 96561));
1929     const parser = createPieServices2().Pie.parser.LangiumParser;
1930     parsers.pie = parser;
1931   }, "pie"),
1932   architecture: /* @__PURE__ */ (0,_chunks_mermaid_parser_core_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_6__/* .__name */ .eW)(async () => {
1933     const { createArchitectureServices: createArchitectureServices2 } = await __webpack_require__.e(/* import() */ 6800).then(__webpack_require__.bind(__webpack_require__, 96800));
1934     const parser = createArchitectureServices2().Architecture.parser.LangiumParser;
1935     parsers.architecture = parser;
1936   }, "architecture"),
1937   gitGraph: /* @__PURE__ */ (0,_chunks_mermaid_parser_core_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_6__/* .__name */ .eW)(async () => {
1938     const { createGitGraphServices: createGitGraphServices2 } = await __webpack_require__.e(/* import() */ 9322).then(__webpack_require__.bind(__webpack_require__, 59322));
1939     const parser = createGitGraphServices2().GitGraph.parser.LangiumParser;
1940     parsers.gitGraph = parser;
1941   }, "gitGraph"),
1942   radar: /* @__PURE__ */ (0,_chunks_mermaid_parser_core_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_6__/* .__name */ .eW)(async () => {
1943     const { createRadarServices: createRadarServices2 } = await __webpack_require__.e(/* import() */ 3076).then(__webpack_require__.bind(__webpack_require__, 73076));
1944     const parser = createRadarServices2().Radar.parser.LangiumParser;
1945     parsers.radar = parser;
1946   }, "radar")
1947 };
1948 async function parse(diagramType, text) {
1949   const initializer = initializers[diagramType];
1950   if (!initializer) {
1951     throw new Error(`Unknown diagram type: ${diagramType}`);
1952   }
1953   if (!parsers[diagramType]) {
1954     await initializer();
1955   }
1956   const parser = parsers[diagramType];
1957   const result = parser.parse(text);
1958   if (result.lexerErrors.length > 0 || result.parserErrors.length > 0) {
1959     throw new MermaidParseError(result);
1960   }
1961   return result.value;
1962 }
1963 (0,_chunks_mermaid_parser_core_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_6__/* .__name */ .eW)(parse, "parse");
1964 var MermaidParseError = class extends Error {
1965   constructor(result) {
1966     const lexerErrors = result.lexerErrors.map((err) => err.message).join("\n");
1967     const parserErrors = result.parserErrors.map((err) => err.message).join("\n");
1968     super(`Parsing failed: ${lexerErrors} ${parserErrors}`);
1969     this.result = result;
1970   }
1971   static {
1972     (0,_chunks_mermaid_parser_core_chunk_7PKI6E2E_mjs__WEBPACK_IMPORTED_MODULE_6__/* .__name */ .eW)(this, "MermaidParseError");
1973   }
1974 };
1975 
1976 
1977 
1978 /***/ }),
1979 
1980 /***/ 34326:
1981 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1982 
1983 "use strict";
1984 
1985 // EXPORTS
1986 __webpack_require__.d(__webpack_exports__, {
1987   ue: () => (/* reexport */ Alternation),
1988   _o: () => (/* reexport */ EMPTY_ALT),
1989   sd: () => (/* reexport */ EOF),
1990   nu: () => (/* reexport */ EmbeddedActionsParser),
1991   dV: () => (/* reexport */ LLkLookaheadStrategy),
1992   hW: () => (/* reexport */ Lexer),
1993   Sj: () => (/* reexport */ NonTerminal),
1994   Wx: () => (/* reexport */ Option),
1995   hI: () => (/* reexport */ Repetition),
1996   ej: () => (/* reexport */ RepetitionMandatory),
1997   fK: () => (/* reexport */ RepetitionMandatoryWithSeparator),
1998   pT: () => (/* reexport */ RepetitionWithSeparator),
1999   oI: () => (/* reexport */ Terminal),
2000   ZW: () => (/* reexport */ defaultLexerErrorProvider),
2001   Hs: () => (/* reexport */ defaultParserErrorProvider),
2002   oC: () => (/* reexport */ getLookaheadPaths),
2003   l$: () => (/* reexport */ tokens_public_tokenLabel),
2004   ol: () => (/* reexport */ tokenMatcher)
2005 });
2006 
2007 // UNUSED EXPORTS: Alternative, CstParser, EarlyExitException, GAstVisitor, LexerDefinitionErrorType, MismatchedTokenException, NoViableAltException, NotAllInputParsedException, Parser, ParserDefinitionErrorType, Rule, VERSION, clearCache, createSyntaxDiagramsCode, createToken, createTokenInstance, generateCstDts, isRecognitionException, serializeGrammar, serializeProduction, tokenName
2008 
2009 // EXTERNAL MODULE: ../node_modules/lodash-es/forEach.js
2010 var forEach = __webpack_require__(21845);
2011 // EXTERNAL MODULE: ../node_modules/lodash-es/values.js + 1 modules
2012 var values = __webpack_require__(88873);
2013 // EXTERNAL MODULE: ../node_modules/lodash-es/isEmpty.js
2014 var isEmpty = __webpack_require__(66400);
2015 // EXTERNAL MODULE: ../node_modules/lodash-es/map.js
2016 var map = __webpack_require__(12930);
2017 // EXTERNAL MODULE: ../node_modules/lodash-es/has.js + 1 modules
2018 var has = __webpack_require__(36004);
2019 // EXTERNAL MODULE: ../node_modules/lodash-es/clone.js
2020 var lodash_es_clone = __webpack_require__(20190);
2021 ;// CONCATENATED MODULE: ../node_modules/@chevrotain/utils/lib/src/to-fast-properties.js
2022 // based on: https://github.com/petkaantonov/bluebird/blob/b97c0d2d487e8c5076e8bd897e0dcd4622d31846/src/util.js#L201-L216
2023 function toFastProperties(toBecomeFast) {
2024     function FakeConstructor() { }
2025     // If our object is used as a constructor, it would receive
2026     FakeConstructor.prototype = toBecomeFast;
2027     const fakeInstance = new FakeConstructor();
2028     function fakeAccess() {
2029         return typeof fakeInstance.bar;
2030     }
2031     // help V8 understand this is a "real" prototype by actually using
2032     // the fake instance.
2033     fakeAccess();
2034     fakeAccess();
2035     // Always true condition to suppress the Firefox warning of unreachable
2036     // code after a return statement.
2037     if (true)
2038         return toBecomeFast;
2039     // Eval prevents optimization of this method (even though this is dead code)
2040     // - https://esbuild.github.io/content-types/#direct-eval
2041     /* istanbul ignore next */
2042     // tslint:disable-next-line
2043     (0, eval)(toBecomeFast);
2044 }
2045 //# sourceMappingURL=to-fast-properties.js.map
2046 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseSlice.js
2047 /**
2048  * The base implementation of `_.slice` without an iteratee call guard.
2049  *
2050  * @private
2051  * @param {Array} array The array to slice.
2052  * @param {number} [start=0] The start position.
2053  * @param {number} [end=array.length] The end position.
2054  * @returns {Array} Returns the slice of `array`.
2055  */
2056 function baseSlice(array, start, end) {
2057   var index = -1,
2058       length = array.length;
2059 
2060   if (start < 0) {
2061     start = -start > length ? 0 : (length + start);
2062   }
2063   end = end > length ? length : end;
2064   if (end < 0) {
2065     end += length;
2066   }
2067   length = start > end ? 0 : ((end - start) >>> 0);
2068   start >>>= 0;
2069 
2070   var result = Array(length);
2071   while (++index < length) {
2072     result[index] = array[index + start];
2073   }
2074   return result;
2075 }
2076 
2077 /* harmony default export */ const _baseSlice = (baseSlice);
2078 
2079 // EXTERNAL MODULE: ../node_modules/lodash-es/toInteger.js
2080 var toInteger = __webpack_require__(98670);
2081 ;// CONCATENATED MODULE: ../node_modules/lodash-es/drop.js
2082 
2083 
2084 
2085 /**
2086  * Creates a slice of `array` with `n` elements dropped from the beginning.
2087  *
2088  * @static
2089  * @memberOf _
2090  * @since 0.5.0
2091  * @category Array
2092  * @param {Array} array The array to query.
2093  * @param {number} [n=1] The number of elements to drop.
2094  * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
2095  * @returns {Array} Returns the slice of `array`.
2096  * @example
2097  *
2098  * _.drop([1, 2, 3]);
2099  * // => [2, 3]
2100  *
2101  * _.drop([1, 2, 3], 2);
2102  * // => [3]
2103  *
2104  * _.drop([1, 2, 3], 5);
2105  * // => []
2106  *
2107  * _.drop([1, 2, 3], 0);
2108  * // => [1, 2, 3]
2109  */
2110 function drop(array, n, guard) {
2111   var length = array == null ? 0 : array.length;
2112   if (!length) {
2113     return [];
2114   }
2115   n = (guard || n === undefined) ? 1 : (0,toInteger/* default */.Z)(n);
2116   return _baseSlice(array, n < 0 ? 0 : n, length);
2117 }
2118 
2119 /* harmony default export */ const lodash_es_drop = (drop);
2120 
2121 // EXTERNAL MODULE: ../node_modules/lodash-es/isString.js
2122 var isString = __webpack_require__(75732);
2123 // EXTERNAL MODULE: ../node_modules/lodash-es/_assignValue.js
2124 var _assignValue = __webpack_require__(15561);
2125 // EXTERNAL MODULE: ../node_modules/lodash-es/_copyObject.js
2126 var _copyObject = __webpack_require__(47313);
2127 // EXTERNAL MODULE: ../node_modules/lodash-es/_createAssigner.js
2128 var _createAssigner = __webpack_require__(40690);
2129 // EXTERNAL MODULE: ../node_modules/lodash-es/isArrayLike.js
2130 var isArrayLike = __webpack_require__(69959);
2131 // EXTERNAL MODULE: ../node_modules/lodash-es/_isPrototype.js
2132 var _isPrototype = __webpack_require__(89418);
2133 // EXTERNAL MODULE: ../node_modules/lodash-es/keys.js
2134 var keys = __webpack_require__(11723);
2135 ;// CONCATENATED MODULE: ../node_modules/lodash-es/assign.js
2136 
2137 
2138 
2139 
2140 
2141 
2142 
2143 /** Used for built-in method references. */
2144 var objectProto = Object.prototype;
2145 
2146 /** Used to check objects for own properties. */
2147 var assign_hasOwnProperty = objectProto.hasOwnProperty;
2148 
2149 /**
2150  * Assigns own enumerable string keyed properties of source objects to the
2151  * destination object. Source objects are applied from left to right.
2152  * Subsequent sources overwrite property assignments of previous sources.
2153  *
2154  * **Note:** This method mutates `object` and is loosely based on
2155  * [`Object.assign`](https://mdn.io/Object/assign).
2156  *
2157  * @static
2158  * @memberOf _
2159  * @since 0.10.0
2160  * @category Object
2161  * @param {Object} object The destination object.
2162  * @param {...Object} [sources] The source objects.
2163  * @returns {Object} Returns `object`.
2164  * @see _.assignIn
2165  * @example
2166  *
2167  * function Foo() {
2168  *   this.a = 1;
2169  * }
2170  *
2171  * function Bar() {
2172  *   this.c = 3;
2173  * }
2174  *
2175  * Foo.prototype.b = 2;
2176  * Bar.prototype.d = 4;
2177  *
2178  * _.assign({ 'a': 0 }, new Foo, new Bar);
2179  * // => { 'a': 1, 'c': 3 }
2180  */
2181 var assign_assign = (0,_createAssigner/* default */.Z)(function(object, source) {
2182   if ((0,_isPrototype/* default */.Z)(source) || (0,isArrayLike/* default */.Z)(source)) {
2183     (0,_copyObject/* default */.Z)(source, (0,keys/* default */.Z)(source), object);
2184     return;
2185   }
2186   for (var key in source) {
2187     if (assign_hasOwnProperty.call(source, key)) {
2188       (0,_assignValue/* default */.Z)(object, key, source[key]);
2189     }
2190   }
2191 });
2192 
2193 /* harmony default export */ const lodash_es_assign = (assign_assign);
2194 
2195 // EXTERNAL MODULE: ../node_modules/lodash-es/_arrayMap.js
2196 var _arrayMap = __webpack_require__(33043);
2197 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseIteratee.js + 15 modules
2198 var _baseIteratee = __webpack_require__(86494);
2199 // EXTERNAL MODULE: ../node_modules/lodash-es/_basePickBy.js + 1 modules
2200 var _basePickBy = __webpack_require__(73338);
2201 // EXTERNAL MODULE: ../node_modules/lodash-es/_getAllKeysIn.js
2202 var _getAllKeysIn = __webpack_require__(5206);
2203 ;// CONCATENATED MODULE: ../node_modules/lodash-es/pickBy.js
2204 
2205 
2206 
2207 
2208 
2209 /**
2210  * Creates an object composed of the `object` properties `predicate` returns
2211  * truthy for. The predicate is invoked with two arguments: (value, key).
2212  *
2213  * @static
2214  * @memberOf _
2215  * @since 4.0.0
2216  * @category Object
2217  * @param {Object} object The source object.
2218  * @param {Function} [predicate=_.identity] The function invoked per property.
2219  * @returns {Object} Returns the new object.
2220  * @example
2221  *
2222  * var object = { 'a': 1, 'b': '2', 'c': 3 };
2223  *
2224  * _.pickBy(object, _.isNumber);
2225  * // => { 'a': 1, 'c': 3 }
2226  */
2227 function pickBy(object, predicate) {
2228   if (object == null) {
2229     return {};
2230   }
2231   var props = (0,_arrayMap/* default */.Z)((0,_getAllKeysIn/* default */.Z)(object), function(prop) {
2232     return [prop];
2233   });
2234   predicate = (0,_baseIteratee/* default */.Z)(predicate);
2235   return (0,_basePickBy/* default */.Z)(object, props, function(value, path) {
2236     return predicate(value, path[0]);
2237   });
2238 }
2239 
2240 /* harmony default export */ const lodash_es_pickBy = (pickBy);
2241 
2242 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseGetTag.js + 2 modules
2243 var _baseGetTag = __webpack_require__(77070);
2244 // EXTERNAL MODULE: ../node_modules/lodash-es/isObjectLike.js
2245 var isObjectLike = __webpack_require__(9615);
2246 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseIsRegExp.js
2247 
2248 
2249 
2250 /** `Object#toString` result references. */
2251 var regexpTag = '[object RegExp]';
2252 
2253 /**
2254  * The base implementation of `_.isRegExp` without Node.js optimizations.
2255  *
2256  * @private
2257  * @param {*} value The value to check.
2258  * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
2259  */
2260 function baseIsRegExp(value) {
2261   return (0,isObjectLike/* default */.Z)(value) && (0,_baseGetTag/* default */.Z)(value) == regexpTag;
2262 }
2263 
2264 /* harmony default export */ const _baseIsRegExp = (baseIsRegExp);
2265 
2266 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseUnary.js
2267 var _baseUnary = __webpack_require__(20274);
2268 // EXTERNAL MODULE: ../node_modules/lodash-es/_nodeUtil.js
2269 var _nodeUtil = __webpack_require__(53594);
2270 ;// CONCATENATED MODULE: ../node_modules/lodash-es/isRegExp.js
2271 
2272 
2273 
2274 
2275 /* Node.js helper references. */
2276 var nodeIsRegExp = _nodeUtil/* default */.Z && _nodeUtil/* default */.Z.isRegExp;
2277 
2278 /**
2279  * Checks if `value` is classified as a `RegExp` object.
2280  *
2281  * @static
2282  * @memberOf _
2283  * @since 0.1.0
2284  * @category Lang
2285  * @param {*} value The value to check.
2286  * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
2287  * @example
2288  *
2289  * _.isRegExp(/abc/);
2290  * // => true
2291  *
2292  * _.isRegExp('/abc/');
2293  * // => false
2294  */
2295 var isRegExp = nodeIsRegExp ? (0,_baseUnary/* default */.Z)(nodeIsRegExp) : _baseIsRegExp;
2296 
2297 /* harmony default export */ const lodash_es_isRegExp = (isRegExp);
2298 
2299 ;// CONCATENATED MODULE: ../node_modules/@chevrotain/gast/lib/src/model.js
2300 
2301 // TODO: duplicated code to avoid extracting another sub-package -- how to avoid?
2302 function tokenLabel(tokType) {
2303     if (hasTokenLabel(tokType)) {
2304         return tokType.LABEL;
2305     }
2306     else {
2307         return tokType.name;
2308     }
2309 }
2310 // TODO: duplicated code to avoid extracting another sub-package -- how to avoid?
2311 function hasTokenLabel(obj) {
2312     return (0,isString/* default */.Z)(obj.LABEL) && obj.LABEL !== "";
2313 }
2314 class AbstractProduction {
2315     get definition() {
2316         return this._definition;
2317     }
2318     set definition(value) {
2319         this._definition = value;
2320     }
2321     constructor(_definition) {
2322         this._definition = _definition;
2323     }
2324     accept(visitor) {
2325         visitor.visit(this);
2326         (0,forEach/* default */.Z)(this.definition, (prod) => {
2327             prod.accept(visitor);
2328         });
2329     }
2330 }
2331 class NonTerminal extends AbstractProduction {
2332     constructor(options) {
2333         super([]);
2334         this.idx = 1;
2335         lodash_es_assign(this, lodash_es_pickBy(options, (v) => v !== undefined));
2336     }
2337     set definition(definition) {
2338         // immutable
2339     }
2340     get definition() {
2341         if (this.referencedRule !== undefined) {
2342             return this.referencedRule.definition;
2343         }
2344         return [];
2345     }
2346     accept(visitor) {
2347         visitor.visit(this);
2348         // don't visit children of a reference, we will get cyclic infinite loops if we do so
2349     }
2350 }
2351 class Rule extends AbstractProduction {
2352     constructor(options) {
2353         super(options.definition);
2354         this.orgText = "";
2355         lodash_es_assign(this, lodash_es_pickBy(options, (v) => v !== undefined));
2356     }
2357 }
2358 class Alternative extends AbstractProduction {
2359     constructor(options) {
2360         super(options.definition);
2361         this.ignoreAmbiguities = false;
2362         lodash_es_assign(this, lodash_es_pickBy(options, (v) => v !== undefined));
2363     }
2364 }
2365 class Option extends AbstractProduction {
2366     constructor(options) {
2367         super(options.definition);
2368         this.idx = 1;
2369         lodash_es_assign(this, lodash_es_pickBy(options, (v) => v !== undefined));
2370     }
2371 }
2372 class RepetitionMandatory extends AbstractProduction {
2373     constructor(options) {
2374         super(options.definition);
2375         this.idx = 1;
2376         lodash_es_assign(this, lodash_es_pickBy(options, (v) => v !== undefined));
2377     }
2378 }
2379 class RepetitionMandatoryWithSeparator extends AbstractProduction {
2380     constructor(options) {
2381         super(options.definition);
2382         this.idx = 1;
2383         lodash_es_assign(this, lodash_es_pickBy(options, (v) => v !== undefined));
2384     }
2385 }
2386 class Repetition extends AbstractProduction {
2387     constructor(options) {
2388         super(options.definition);
2389         this.idx = 1;
2390         lodash_es_assign(this, lodash_es_pickBy(options, (v) => v !== undefined));
2391     }
2392 }
2393 class RepetitionWithSeparator extends AbstractProduction {
2394     constructor(options) {
2395         super(options.definition);
2396         this.idx = 1;
2397         lodash_es_assign(this, lodash_es_pickBy(options, (v) => v !== undefined));
2398     }
2399 }
2400 class Alternation extends AbstractProduction {
2401     get definition() {
2402         return this._definition;
2403     }
2404     set definition(value) {
2405         this._definition = value;
2406     }
2407     constructor(options) {
2408         super(options.definition);
2409         this.idx = 1;
2410         this.ignoreAmbiguities = false;
2411         this.hasPredicates = false;
2412         lodash_es_assign(this, lodash_es_pickBy(options, (v) => v !== undefined));
2413     }
2414 }
2415 class Terminal {
2416     constructor(options) {
2417         this.idx = 1;
2418         lodash_es_assign(this, lodash_es_pickBy(options, (v) => v !== undefined));
2419     }
2420     accept(visitor) {
2421         visitor.visit(this);
2422     }
2423 }
2424 function serializeGrammar(topRules) {
2425     return (0,map/* default */.Z)(topRules, serializeProduction);
2426 }
2427 function serializeProduction(node) {
2428     function convertDefinition(definition) {
2429         return (0,map/* default */.Z)(definition, serializeProduction);
2430     }
2431     /* istanbul ignore else */
2432     if (node instanceof NonTerminal) {
2433         const serializedNonTerminal = {
2434             type: "NonTerminal",
2435             name: node.nonTerminalName,
2436             idx: node.idx,
2437         };
2438         if ((0,isString/* default */.Z)(node.label)) {
2439             serializedNonTerminal.label = node.label;
2440         }
2441         return serializedNonTerminal;
2442     }
2443     else if (node instanceof Alternative) {
2444         return {
2445             type: "Alternative",
2446             definition: convertDefinition(node.definition),
2447         };
2448     }
2449     else if (node instanceof Option) {
2450         return {
2451             type: "Option",
2452             idx: node.idx,
2453             definition: convertDefinition(node.definition),
2454         };
2455     }
2456     else if (node instanceof RepetitionMandatory) {
2457         return {
2458             type: "RepetitionMandatory",
2459             idx: node.idx,
2460             definition: convertDefinition(node.definition),
2461         };
2462     }
2463     else if (node instanceof RepetitionMandatoryWithSeparator) {
2464         return {
2465             type: "RepetitionMandatoryWithSeparator",
2466             idx: node.idx,
2467             separator: (serializeProduction(new Terminal({ terminalType: node.separator }))),
2468             definition: convertDefinition(node.definition),
2469         };
2470     }
2471     else if (node instanceof RepetitionWithSeparator) {
2472         return {
2473             type: "RepetitionWithSeparator",
2474             idx: node.idx,
2475             separator: (serializeProduction(new Terminal({ terminalType: node.separator }))),
2476             definition: convertDefinition(node.definition),
2477         };
2478     }
2479     else if (node instanceof Repetition) {
2480         return {
2481             type: "Repetition",
2482             idx: node.idx,
2483             definition: convertDefinition(node.definition),
2484         };
2485     }
2486     else if (node instanceof Alternation) {
2487         return {
2488             type: "Alternation",
2489             idx: node.idx,
2490             definition: convertDefinition(node.definition),
2491         };
2492     }
2493     else if (node instanceof Terminal) {
2494         const serializedTerminal = {
2495             type: "Terminal",
2496             name: node.terminalType.name,
2497             label: tokenLabel(node.terminalType),
2498             idx: node.idx,
2499         };
2500         if ((0,isString/* default */.Z)(node.label)) {
2501             serializedTerminal.terminalLabel = node.label;
2502         }
2503         const pattern = node.terminalType.PATTERN;
2504         if (node.terminalType.PATTERN) {
2505             serializedTerminal.pattern = lodash_es_isRegExp(pattern)
2506                 ? pattern.source
2507                 : pattern;
2508         }
2509         return serializedTerminal;
2510     }
2511     else if (node instanceof Rule) {
2512         return {
2513             type: "Rule",
2514             name: node.name,
2515             orgText: node.orgText,
2516             definition: convertDefinition(node.definition),
2517         };
2518         /* c8 ignore next 3 */
2519     }
2520     else {
2521         throw Error("non exhaustive match");
2522     }
2523 }
2524 //# sourceMappingURL=model.js.map
2525 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/grammar/rest.js
2526 
2527 
2528 /**
2529  *  A Grammar Walker that computes the "remaining" grammar "after" a productions in the grammar.
2530  */
2531 class RestWalker {
2532     walk(prod, prevRest = []) {
2533         (0,forEach/* default */.Z)(prod.definition, (subProd, index) => {
2534             const currRest = lodash_es_drop(prod.definition, index + 1);
2535             /* istanbul ignore else */
2536             if (subProd instanceof NonTerminal) {
2537                 this.walkProdRef(subProd, currRest, prevRest);
2538             }
2539             else if (subProd instanceof Terminal) {
2540                 this.walkTerminal(subProd, currRest, prevRest);
2541             }
2542             else if (subProd instanceof Alternative) {
2543                 this.walkFlat(subProd, currRest, prevRest);
2544             }
2545             else if (subProd instanceof Option) {
2546                 this.walkOption(subProd, currRest, prevRest);
2547             }
2548             else if (subProd instanceof RepetitionMandatory) {
2549                 this.walkAtLeastOne(subProd, currRest, prevRest);
2550             }
2551             else if (subProd instanceof RepetitionMandatoryWithSeparator) {
2552                 this.walkAtLeastOneSep(subProd, currRest, prevRest);
2553             }
2554             else if (subProd instanceof RepetitionWithSeparator) {
2555                 this.walkManySep(subProd, currRest, prevRest);
2556             }
2557             else if (subProd instanceof Repetition) {
2558                 this.walkMany(subProd, currRest, prevRest);
2559             }
2560             else if (subProd instanceof Alternation) {
2561                 this.walkOr(subProd, currRest, prevRest);
2562             }
2563             else {
2564                 throw Error("non exhaustive match");
2565             }
2566         });
2567     }
2568     walkTerminal(terminal, currRest, prevRest) { }
2569     walkProdRef(refProd, currRest, prevRest) { }
2570     walkFlat(flatProd, currRest, prevRest) {
2571         // ABCDEF => after the D the rest is EF
2572         const fullOrRest = currRest.concat(prevRest);
2573         this.walk(flatProd, fullOrRest);
2574     }
2575     walkOption(optionProd, currRest, prevRest) {
2576         // ABC(DE)?F => after the (DE)? the rest is F
2577         const fullOrRest = currRest.concat(prevRest);
2578         this.walk(optionProd, fullOrRest);
2579     }
2580     walkAtLeastOne(atLeastOneProd, currRest, prevRest) {
2581         // ABC(DE)+F => after the (DE)+ the rest is (DE)?F
2582         const fullAtLeastOneRest = [
2583             new Option({ definition: atLeastOneProd.definition }),
2584         ].concat(currRest, prevRest);
2585         this.walk(atLeastOneProd, fullAtLeastOneRest);
2586     }
2587     walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) {
2588         // ABC DE(,DE)* F => after the (,DE)+ the rest is (,DE)?F
2589         const fullAtLeastOneSepRest = restForRepetitionWithSeparator(atLeastOneSepProd, currRest, prevRest);
2590         this.walk(atLeastOneSepProd, fullAtLeastOneSepRest);
2591     }
2592     walkMany(manyProd, currRest, prevRest) {
2593         // ABC(DE)*F => after the (DE)* the rest is (DE)?F
2594         const fullManyRest = [
2595             new Option({ definition: manyProd.definition }),
2596         ].concat(currRest, prevRest);
2597         this.walk(manyProd, fullManyRest);
2598     }
2599     walkManySep(manySepProd, currRest, prevRest) {
2600         // ABC (DE(,DE)*)? F => after the (,DE)* the rest is (,DE)?F
2601         const fullManySepRest = restForRepetitionWithSeparator(manySepProd, currRest, prevRest);
2602         this.walk(manySepProd, fullManySepRest);
2603     }
2604     walkOr(orProd, currRest, prevRest) {
2605         // ABC(D|E|F)G => when finding the (D|E|F) the rest is G
2606         const fullOrRest = currRest.concat(prevRest);
2607         // walk all different alternatives
2608         (0,forEach/* default */.Z)(orProd.definition, (alt) => {
2609             // wrapping each alternative in a single definition wrapper
2610             // to avoid errors in computing the rest of that alternative in the invocation to computeInProdFollows
2611             // (otherwise for OR([alt1,alt2]) alt2 will be considered in 'rest' of alt1
2612             const prodWrapper = new Alternative({ definition: [alt] });
2613             this.walk(prodWrapper, fullOrRest);
2614         });
2615     }
2616 }
2617 function restForRepetitionWithSeparator(repSepProd, currRest, prevRest) {
2618     const repSepRest = [
2619         new Option({
2620             definition: [
2621                 new Terminal({ terminalType: repSepProd.separator }),
2622             ].concat(repSepProd.definition),
2623         }),
2624     ];
2625     const fullRepSepRest = repSepRest.concat(currRest, prevRest);
2626     return fullRepSepRest;
2627 }
2628 //# sourceMappingURL=rest.js.map
2629 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseUniq.js + 1 modules
2630 var _baseUniq = __webpack_require__(99633);
2631 ;// CONCATENATED MODULE: ../node_modules/lodash-es/uniq.js
2632 
2633 
2634 /**
2635  * Creates a duplicate-free version of an array, using
2636  * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2637  * for equality comparisons, in which only the first occurrence of each element
2638  * is kept. The order of result values is determined by the order they occur
2639  * in the array.
2640  *
2641  * @static
2642  * @memberOf _
2643  * @since 0.1.0
2644  * @category Array
2645  * @param {Array} array The array to inspect.
2646  * @returns {Array} Returns the new duplicate free array.
2647  * @example
2648  *
2649  * _.uniq([2, 1, 2]);
2650  * // => [2, 1]
2651  */
2652 function uniq(array) {
2653   return (array && array.length) ? (0,_baseUniq/* default */.Z)(array) : [];
2654 }
2655 
2656 /* harmony default export */ const lodash_es_uniq = (uniq);
2657 
2658 // EXTERNAL MODULE: ../node_modules/lodash-es/flatten.js
2659 var flatten = __webpack_require__(28099);
2660 // EXTERNAL MODULE: ../node_modules/lodash-es/_arraySome.js
2661 var _arraySome = __webpack_require__(82964);
2662 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseEach.js + 1 modules
2663 var _baseEach = __webpack_require__(77201);
2664 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseSome.js
2665 
2666 
2667 /**
2668  * The base implementation of `_.some` without support for iteratee shorthands.
2669  *
2670  * @private
2671  * @param {Array|Object} collection The collection to iterate over.
2672  * @param {Function} predicate The function invoked per iteration.
2673  * @returns {boolean} Returns `true` if any element passes the predicate check,
2674  *  else `false`.
2675  */
2676 function baseSome(collection, predicate) {
2677   var result;
2678 
2679   (0,_baseEach/* default */.Z)(collection, function(value, index, collection) {
2680     result = predicate(value, index, collection);
2681     return !result;
2682   });
2683   return !!result;
2684 }
2685 
2686 /* harmony default export */ const _baseSome = (baseSome);
2687 
2688 // EXTERNAL MODULE: ../node_modules/lodash-es/isArray.js
2689 var isArray = __webpack_require__(64058);
2690 // EXTERNAL MODULE: ../node_modules/lodash-es/_isIterateeCall.js
2691 var _isIterateeCall = __webpack_require__(47952);
2692 ;// CONCATENATED MODULE: ../node_modules/lodash-es/some.js
2693 
2694 
2695 
2696 
2697 
2698 
2699 /**
2700  * Checks if `predicate` returns truthy for **any** element of `collection`.
2701  * Iteration is stopped once `predicate` returns truthy. The predicate is
2702  * invoked with three arguments: (value, index|key, collection).
2703  *
2704  * @static
2705  * @memberOf _
2706  * @since 0.1.0
2707  * @category Collection
2708  * @param {Array|Object} collection The collection to iterate over.
2709  * @param {Function} [predicate=_.identity] The function invoked per iteration.
2710  * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
2711  * @returns {boolean} Returns `true` if any element passes the predicate check,
2712  *  else `false`.
2713  * @example
2714  *
2715  * _.some([null, 0, 'yes', false], Boolean);
2716  * // => true
2717  *
2718  * var users = [
2719  *   { 'user': 'barney', 'active': true },
2720  *   { 'user': 'fred',   'active': false }
2721  * ];
2722  *
2723  * // The `_.matches` iteratee shorthand.
2724  * _.some(users, { 'user': 'barney', 'active': false });
2725  * // => false
2726  *
2727  * // The `_.matchesProperty` iteratee shorthand.
2728  * _.some(users, ['active', false]);
2729  * // => true
2730  *
2731  * // The `_.property` iteratee shorthand.
2732  * _.some(users, 'active');
2733  * // => true
2734  */
2735 function some(collection, predicate, guard) {
2736   var func = (0,isArray/* default */.Z)(collection) ? _arraySome/* default */.Z : _baseSome;
2737   if (guard && (0,_isIterateeCall/* default */.Z)(collection, predicate, guard)) {
2738     predicate = undefined;
2739   }
2740   return func(collection, (0,_baseIteratee/* default */.Z)(predicate, 3));
2741 }
2742 
2743 /* harmony default export */ const lodash_es_some = (some);
2744 
2745 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseIndexOf.js + 2 modules
2746 var _baseIndexOf = __webpack_require__(90393);
2747 ;// CONCATENATED MODULE: ../node_modules/lodash-es/includes.js
2748 
2749 
2750 
2751 
2752 
2753 
2754 /* Built-in method references for those with the same name as other `lodash` methods. */
2755 var nativeMax = Math.max;
2756 
2757 /**
2758  * Checks if `value` is in `collection`. If `collection` is a string, it's
2759  * checked for a substring of `value`, otherwise
2760  * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2761  * is used for equality comparisons. If `fromIndex` is negative, it's used as
2762  * the offset from the end of `collection`.
2763  *
2764  * @static
2765  * @memberOf _
2766  * @since 0.1.0
2767  * @category Collection
2768  * @param {Array|Object|string} collection The collection to inspect.
2769  * @param {*} value The value to search for.
2770  * @param {number} [fromIndex=0] The index to search from.
2771  * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
2772  * @returns {boolean} Returns `true` if `value` is found, else `false`.
2773  * @example
2774  *
2775  * _.includes([1, 2, 3], 1);
2776  * // => true
2777  *
2778  * _.includes([1, 2, 3], 1, 2);
2779  * // => false
2780  *
2781  * _.includes({ 'a': 1, 'b': 2 }, 1);
2782  * // => true
2783  *
2784  * _.includes('abcd', 'bc');
2785  * // => true
2786  */
2787 function includes(collection, value, fromIndex, guard) {
2788   collection = (0,isArrayLike/* default */.Z)(collection) ? collection : (0,values/* default */.Z)(collection);
2789   fromIndex = (fromIndex && !guard) ? (0,toInteger/* default */.Z)(fromIndex) : 0;
2790 
2791   var length = collection.length;
2792   if (fromIndex < 0) {
2793     fromIndex = nativeMax(length + fromIndex, 0);
2794   }
2795   return (0,isString/* default */.Z)(collection)
2796     ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
2797     : (!!length && (0,_baseIndexOf/* default */.Z)(collection, value, fromIndex) > -1);
2798 }
2799 
2800 /* harmony default export */ const lodash_es_includes = (includes);
2801 
2802 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_arrayEvery.js
2803 /**
2804  * A specialized version of `_.every` for arrays without support for
2805  * iteratee shorthands.
2806  *
2807  * @private
2808  * @param {Array} [array] The array to iterate over.
2809  * @param {Function} predicate The function invoked per iteration.
2810  * @returns {boolean} Returns `true` if all elements pass the predicate check,
2811  *  else `false`.
2812  */
2813 function arrayEvery(array, predicate) {
2814   var index = -1,
2815       length = array == null ? 0 : array.length;
2816 
2817   while (++index < length) {
2818     if (!predicate(array[index], index, array)) {
2819       return false;
2820     }
2821   }
2822   return true;
2823 }
2824 
2825 /* harmony default export */ const _arrayEvery = (arrayEvery);
2826 
2827 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseEvery.js
2828 
2829 
2830 /**
2831  * The base implementation of `_.every` without support for iteratee shorthands.
2832  *
2833  * @private
2834  * @param {Array|Object} collection The collection to iterate over.
2835  * @param {Function} predicate The function invoked per iteration.
2836  * @returns {boolean} Returns `true` if all elements pass the predicate check,
2837  *  else `false`
2838  */
2839 function baseEvery(collection, predicate) {
2840   var result = true;
2841   (0,_baseEach/* default */.Z)(collection, function(value, index, collection) {
2842     result = !!predicate(value, index, collection);
2843     return result;
2844   });
2845   return result;
2846 }
2847 
2848 /* harmony default export */ const _baseEvery = (baseEvery);
2849 
2850 ;// CONCATENATED MODULE: ../node_modules/lodash-es/every.js
2851 
2852 
2853 
2854 
2855 
2856 
2857 /**
2858  * Checks if `predicate` returns truthy for **all** elements of `collection`.
2859  * Iteration is stopped once `predicate` returns falsey. The predicate is
2860  * invoked with three arguments: (value, index|key, collection).
2861  *
2862  * **Note:** This method returns `true` for
2863  * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
2864  * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
2865  * elements of empty collections.
2866  *
2867  * @static
2868  * @memberOf _
2869  * @since 0.1.0
2870  * @category Collection
2871  * @param {Array|Object} collection The collection to iterate over.
2872  * @param {Function} [predicate=_.identity] The function invoked per iteration.
2873  * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
2874  * @returns {boolean} Returns `true` if all elements pass the predicate check,
2875  *  else `false`.
2876  * @example
2877  *
2878  * _.every([true, 1, null, 'yes'], Boolean);
2879  * // => false
2880  *
2881  * var users = [
2882  *   { 'user': 'barney', 'age': 36, 'active': false },
2883  *   { 'user': 'fred',   'age': 40, 'active': false }
2884  * ];
2885  *
2886  * // The `_.matches` iteratee shorthand.
2887  * _.every(users, { 'user': 'barney', 'active': false });
2888  * // => false
2889  *
2890  * // The `_.matchesProperty` iteratee shorthand.
2891  * _.every(users, ['active', false]);
2892  * // => true
2893  *
2894  * // The `_.property` iteratee shorthand.
2895  * _.every(users, 'active');
2896  * // => false
2897  */
2898 function every(collection, predicate, guard) {
2899   var func = (0,isArray/* default */.Z)(collection) ? _arrayEvery : _baseEvery;
2900   if (guard && (0,_isIterateeCall/* default */.Z)(collection, predicate, guard)) {
2901     predicate = undefined;
2902   }
2903   return func(collection, (0,_baseIteratee/* default */.Z)(predicate, 3));
2904 }
2905 
2906 /* harmony default export */ const lodash_es_every = (every);
2907 
2908 ;// CONCATENATED MODULE: ../node_modules/@chevrotain/gast/lib/src/helpers.js
2909 
2910 
2911 function isSequenceProd(prod) {
2912     return (prod instanceof Alternative ||
2913         prod instanceof Option ||
2914         prod instanceof Repetition ||
2915         prod instanceof RepetitionMandatory ||
2916         prod instanceof RepetitionMandatoryWithSeparator ||
2917         prod instanceof RepetitionWithSeparator ||
2918         prod instanceof Terminal ||
2919         prod instanceof Rule);
2920 }
2921 function isOptionalProd(prod, alreadyVisited = []) {
2922     const isDirectlyOptional = prod instanceof Option ||
2923         prod instanceof Repetition ||
2924         prod instanceof RepetitionWithSeparator;
2925     if (isDirectlyOptional) {
2926         return true;
2927     }
2928     // note that this can cause infinite loop if one optional empty TOP production has a cyclic dependency with another
2929     // empty optional top rule
2930     // may be indirectly optional ((A?B?C?) | (D?E?F?))
2931     if (prod instanceof Alternation) {
2932         // for OR its enough for just one of the alternatives to be optional
2933         return lodash_es_some(prod.definition, (subProd) => {
2934             return isOptionalProd(subProd, alreadyVisited);
2935         });
2936     }
2937     else if (prod instanceof NonTerminal && lodash_es_includes(alreadyVisited, prod)) {
2938         // avoiding stack overflow due to infinite recursion
2939         return false;
2940     }
2941     else if (prod instanceof AbstractProduction) {
2942         if (prod instanceof NonTerminal) {
2943             alreadyVisited.push(prod);
2944         }
2945         return lodash_es_every(prod.definition, (subProd) => {
2946             return isOptionalProd(subProd, alreadyVisited);
2947         });
2948     }
2949     else {
2950         return false;
2951     }
2952 }
2953 function isBranchingProd(prod) {
2954     return prod instanceof Alternation;
2955 }
2956 function getProductionDslName(prod) {
2957     /* istanbul ignore else */
2958     if (prod instanceof NonTerminal) {
2959         return "SUBRULE";
2960     }
2961     else if (prod instanceof Option) {
2962         return "OPTION";
2963     }
2964     else if (prod instanceof Alternation) {
2965         return "OR";
2966     }
2967     else if (prod instanceof RepetitionMandatory) {
2968         return "AT_LEAST_ONE";
2969     }
2970     else if (prod instanceof RepetitionMandatoryWithSeparator) {
2971         return "AT_LEAST_ONE_SEP";
2972     }
2973     else if (prod instanceof RepetitionWithSeparator) {
2974         return "MANY_SEP";
2975     }
2976     else if (prod instanceof Repetition) {
2977         return "MANY";
2978     }
2979     else if (prod instanceof Terminal) {
2980         return "CONSUME";
2981         /* c8 ignore next 3 */
2982     }
2983     else {
2984         throw Error("non exhaustive match");
2985     }
2986 }
2987 //# sourceMappingURL=helpers.js.map
2988 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/grammar/first.js
2989 
2990 
2991 function first(prod) {
2992     /* istanbul ignore else */
2993     if (prod instanceof NonTerminal) {
2994         // this could in theory cause infinite loops if
2995         // (1) prod A refs prod B.
2996         // (2) prod B refs prod A
2997         // (3) AB can match the empty set
2998         // in other words a cycle where everything is optional so the first will keep
2999         // looking ahead for the next optional part and will never exit
3000         // currently there is no safeguard for this unique edge case because
3001         // (1) not sure a grammar in which this can happen is useful for anything (productive)
3002         return first(prod.referencedRule);
3003     }
3004     else if (prod instanceof Terminal) {
3005         return firstForTerminal(prod);
3006     }
3007     else if (isSequenceProd(prod)) {
3008         return firstForSequence(prod);
3009     }
3010     else if (isBranchingProd(prod)) {
3011         return firstForBranching(prod);
3012     }
3013     else {
3014         throw Error("non exhaustive match");
3015     }
3016 }
3017 function firstForSequence(prod) {
3018     let firstSet = [];
3019     const seq = prod.definition;
3020     let nextSubProdIdx = 0;
3021     let hasInnerProdsRemaining = seq.length > nextSubProdIdx;
3022     let currSubProd;
3023     // so we enter the loop at least once (if the definition is not empty
3024     let isLastInnerProdOptional = true;
3025     // scan a sequence until it's end or until we have found a NONE optional production in it
3026     while (hasInnerProdsRemaining && isLastInnerProdOptional) {
3027         currSubProd = seq[nextSubProdIdx];
3028         isLastInnerProdOptional = isOptionalProd(currSubProd);
3029         firstSet = firstSet.concat(first(currSubProd));
3030         nextSubProdIdx = nextSubProdIdx + 1;
3031         hasInnerProdsRemaining = seq.length > nextSubProdIdx;
3032     }
3033     return lodash_es_uniq(firstSet);
3034 }
3035 function firstForBranching(prod) {
3036     const allAlternativesFirsts = (0,map/* default */.Z)(prod.definition, (innerProd) => {
3037         return first(innerProd);
3038     });
3039     return lodash_es_uniq((0,flatten/* default */.Z)(allAlternativesFirsts));
3040 }
3041 function firstForTerminal(terminal) {
3042     return [terminal.terminalType];
3043 }
3044 //# sourceMappingURL=first.js.map
3045 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/constants.js
3046 // TODO: can this be removed? where is it used?
3047 const constants_IN = "_~IN~_";
3048 //# sourceMappingURL=constants.js.map
3049 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/grammar/follow.js
3050 
3051 
3052 
3053 
3054 
3055 // This ResyncFollowsWalker computes all of the follows required for RESYNC
3056 // (skipping reference production).
3057 class ResyncFollowsWalker extends RestWalker {
3058     constructor(topProd) {
3059         super();
3060         this.topProd = topProd;
3061         this.follows = {};
3062     }
3063     startWalking() {
3064         this.walk(this.topProd);
3065         return this.follows;
3066     }
3067     walkTerminal(terminal, currRest, prevRest) {
3068         // do nothing! just like in the public sector after 13:00
3069     }
3070     walkProdRef(refProd, currRest, prevRest) {
3071         const followName = buildBetweenProdsFollowPrefix(refProd.referencedRule, refProd.idx) +
3072             this.topProd.name;
3073         const fullRest = currRest.concat(prevRest);
3074         const restProd = new Alternative({ definition: fullRest });
3075         const t_in_topProd_follows = first(restProd);
3076         this.follows[followName] = t_in_topProd_follows;
3077     }
3078 }
3079 function computeAllProdsFollows(topProductions) {
3080     const reSyncFollows = {};
3081     (0,forEach/* default */.Z)(topProductions, (topProd) => {
3082         const currRefsFollow = new ResyncFollowsWalker(topProd).startWalking();
3083         lodash_es_assign(reSyncFollows, currRefsFollow);
3084     });
3085     return reSyncFollows;
3086 }
3087 function buildBetweenProdsFollowPrefix(inner, occurenceInParent) {
3088     return inner.name + occurenceInParent + constants_IN;
3089 }
3090 function buildInProdFollowPrefix(terminal) {
3091     const terminalName = terminal.terminalType.name;
3092     return terminalName + terminal.idx + IN;
3093 }
3094 //# sourceMappingURL=follow.js.map
3095 // EXTERNAL MODULE: ../node_modules/lodash-es/isUndefined.js
3096 var isUndefined = __webpack_require__(52307);
3097 // EXTERNAL MODULE: ../node_modules/@chevrotain/regexp-to-ast/lib/src/api.js + 4 modules
3098 var api = __webpack_require__(77647);
3099 // EXTERNAL MODULE: ../node_modules/lodash-es/defaults.js
3100 var defaults = __webpack_require__(65479);
3101 // EXTERNAL MODULE: ../node_modules/lodash-es/_arrayFilter.js
3102 var _arrayFilter = __webpack_require__(11819);
3103 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseFilter.js
3104 var _baseFilter = __webpack_require__(45701);
3105 ;// CONCATENATED MODULE: ../node_modules/lodash-es/negate.js
3106 /** Error message constants. */
3107 var FUNC_ERROR_TEXT = 'Expected a function';
3108 
3109 /**
3110  * Creates a function that negates the result of the predicate `func`. The
3111  * `func` predicate is invoked with the `this` binding and arguments of the
3112  * created function.
3113  *
3114  * @static
3115  * @memberOf _
3116  * @since 3.0.0
3117  * @category Function
3118  * @param {Function} predicate The predicate to negate.
3119  * @returns {Function} Returns the new negated function.
3120  * @example
3121  *
3122  * function isEven(n) {
3123  *   return n % 2 == 0;
3124  * }
3125  *
3126  * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
3127  * // => [1, 3, 5]
3128  */
3129 function negate(predicate) {
3130   if (typeof predicate != 'function') {
3131     throw new TypeError(FUNC_ERROR_TEXT);
3132   }
3133   return function() {
3134     var args = arguments;
3135     switch (args.length) {
3136       case 0: return !predicate.call(this);
3137       case 1: return !predicate.call(this, args[0]);
3138       case 2: return !predicate.call(this, args[0], args[1]);
3139       case 3: return !predicate.call(this, args[0], args[1], args[2]);
3140     }
3141     return !predicate.apply(this, args);
3142   };
3143 }
3144 
3145 /* harmony default export */ const lodash_es_negate = (negate);
3146 
3147 ;// CONCATENATED MODULE: ../node_modules/lodash-es/reject.js
3148 
3149 
3150 
3151 
3152 
3153 
3154 /**
3155  * The opposite of `_.filter`; this method returns the elements of `collection`
3156  * that `predicate` does **not** return truthy for.
3157  *
3158  * @static
3159  * @memberOf _
3160  * @since 0.1.0
3161  * @category Collection
3162  * @param {Array|Object} collection The collection to iterate over.
3163  * @param {Function} [predicate=_.identity] The function invoked per iteration.
3164  * @returns {Array} Returns the new filtered array.
3165  * @see _.filter
3166  * @example
3167  *
3168  * var users = [
3169  *   { 'user': 'barney', 'age': 36, 'active': false },
3170  *   { 'user': 'fred',   'age': 40, 'active': true }
3171  * ];
3172  *
3173  * _.reject(users, function(o) { return !o.active; });
3174  * // => objects for ['fred']
3175  *
3176  * // The `_.matches` iteratee shorthand.
3177  * _.reject(users, { 'age': 40, 'active': true });
3178  * // => objects for ['barney']
3179  *
3180  * // The `_.matchesProperty` iteratee shorthand.
3181  * _.reject(users, ['active', false]);
3182  * // => objects for ['fred']
3183  *
3184  * // The `_.property` iteratee shorthand.
3185  * _.reject(users, 'active');
3186  * // => objects for ['barney']
3187  */
3188 function reject(collection, predicate) {
3189   var func = (0,isArray/* default */.Z)(collection) ? _arrayFilter/* default */.Z : _baseFilter/* default */.Z;
3190   return func(collection, lodash_es_negate((0,_baseIteratee/* default */.Z)(predicate, 3)));
3191 }
3192 
3193 /* harmony default export */ const lodash_es_reject = (reject);
3194 
3195 // EXTERNAL MODULE: ../node_modules/lodash-es/isFunction.js
3196 var isFunction = __webpack_require__(48489);
3197 ;// CONCATENATED MODULE: ../node_modules/lodash-es/indexOf.js
3198 
3199 
3200 
3201 /* Built-in method references for those with the same name as other `lodash` methods. */
3202 var indexOf_nativeMax = Math.max;
3203 
3204 /**
3205  * Gets the index at which the first occurrence of `value` is found in `array`
3206  * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
3207  * for equality comparisons. If `fromIndex` is negative, it's used as the
3208  * offset from the end of `array`.
3209  *
3210  * @static
3211  * @memberOf _
3212  * @since 0.1.0
3213  * @category Array
3214  * @param {Array} array The array to inspect.
3215  * @param {*} value The value to search for.
3216  * @param {number} [fromIndex=0] The index to search from.
3217  * @returns {number} Returns the index of the matched value, else `-1`.
3218  * @example
3219  *
3220  * _.indexOf([1, 2, 1, 2], 2);
3221  * // => 1
3222  *
3223  * // Search from the `fromIndex`.
3224  * _.indexOf([1, 2, 1, 2], 2, 2);
3225  * // => 3
3226  */
3227 function indexOf(array, value, fromIndex) {
3228   var length = array == null ? 0 : array.length;
3229   if (!length) {
3230     return -1;
3231   }
3232   var index = fromIndex == null ? 0 : (0,toInteger/* default */.Z)(fromIndex);
3233   if (index < 0) {
3234     index = indexOf_nativeMax(length + index, 0);
3235   }
3236   return (0,_baseIndexOf/* default */.Z)(array, value, index);
3237 }
3238 
3239 /* harmony default export */ const lodash_es_indexOf = (indexOf);
3240 
3241 // EXTERNAL MODULE: ../node_modules/lodash-es/reduce.js + 2 modules
3242 var reduce = __webpack_require__(99413);
3243 // EXTERNAL MODULE: ../node_modules/lodash-es/filter.js
3244 var filter = __webpack_require__(11382);
3245 // EXTERNAL MODULE: ../node_modules/lodash-es/_SetCache.js + 2 modules
3246 var _SetCache = __webpack_require__(40105);
3247 // EXTERNAL MODULE: ../node_modules/lodash-es/_arrayIncludes.js
3248 var _arrayIncludes = __webpack_require__(79036);
3249 // EXTERNAL MODULE: ../node_modules/lodash-es/_arrayIncludesWith.js
3250 var _arrayIncludesWith = __webpack_require__(58084);
3251 // EXTERNAL MODULE: ../node_modules/lodash-es/_cacheHas.js
3252 var _cacheHas = __webpack_require__(8142);
3253 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseDifference.js
3254 
3255 
3256 
3257 
3258 
3259 
3260 
3261 /** Used as the size to enable large array optimizations. */
3262 var LARGE_ARRAY_SIZE = 200;
3263 
3264 /**
3265  * The base implementation of methods like `_.difference` without support
3266  * for excluding multiple arrays or iteratee shorthands.
3267  *
3268  * @private
3269  * @param {Array} array The array to inspect.
3270  * @param {Array} values The values to exclude.
3271  * @param {Function} [iteratee] The iteratee invoked per element.
3272  * @param {Function} [comparator] The comparator invoked per element.
3273  * @returns {Array} Returns the new array of filtered values.
3274  */
3275 function baseDifference(array, values, iteratee, comparator) {
3276   var index = -1,
3277       includes = _arrayIncludes/* default */.Z,
3278       isCommon = true,
3279       length = array.length,
3280       result = [],
3281       valuesLength = values.length;
3282 
3283   if (!length) {
3284     return result;
3285   }
3286   if (iteratee) {
3287     values = (0,_arrayMap/* default */.Z)(values, (0,_baseUnary/* default */.Z)(iteratee));
3288   }
3289   if (comparator) {
3290     includes = _arrayIncludesWith/* default */.Z;
3291     isCommon = false;
3292   }
3293   else if (values.length >= LARGE_ARRAY_SIZE) {
3294     includes = _cacheHas/* default */.Z;
3295     isCommon = false;
3296     values = new _SetCache/* default */.Z(values);
3297   }
3298   outer:
3299   while (++index < length) {
3300     var value = array[index],
3301         computed = iteratee == null ? value : iteratee(value);
3302 
3303     value = (comparator || value !== 0) ? value : 0;
3304     if (isCommon && computed === computed) {
3305       var valuesIndex = valuesLength;
3306       while (valuesIndex--) {
3307         if (values[valuesIndex] === computed) {
3308           continue outer;
3309         }
3310       }
3311       result.push(value);
3312     }
3313     else if (!includes(values, computed, comparator)) {
3314       result.push(value);
3315     }
3316   }
3317   return result;
3318 }
3319 
3320 /* harmony default export */ const _baseDifference = (baseDifference);
3321 
3322 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseFlatten.js + 1 modules
3323 var _baseFlatten = __webpack_require__(65029);
3324 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseRest.js
3325 var _baseRest = __webpack_require__(99719);
3326 // EXTERNAL MODULE: ../node_modules/lodash-es/isArrayLikeObject.js
3327 var isArrayLikeObject = __webpack_require__(60492);
3328 ;// CONCATENATED MODULE: ../node_modules/lodash-es/difference.js
3329 
3330 
3331 
3332 
3333 
3334 /**
3335  * Creates an array of `array` values not included in the other given arrays
3336  * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
3337  * for equality comparisons. The order and references of result values are
3338  * determined by the first array.
3339  *
3340  * **Note:** Unlike `_.pullAll`, this method returns a new array.
3341  *
3342  * @static
3343  * @memberOf _
3344  * @since 0.1.0
3345  * @category Array
3346  * @param {Array} array The array to inspect.
3347  * @param {...Array} [values] The values to exclude.
3348  * @returns {Array} Returns the new array of filtered values.
3349  * @see _.without, _.xor
3350  * @example
3351  *
3352  * _.difference([2, 1], [2, 3]);
3353  * // => [1]
3354  */
3355 var difference = (0,_baseRest/* default */.Z)(function(array, values) {
3356   return (0,isArrayLikeObject/* default */.Z)(array)
3357     ? _baseDifference(array, (0,_baseFlatten/* default */.Z)(values, 1, isArrayLikeObject/* default */.Z, true))
3358     : [];
3359 });
3360 
3361 /* harmony default export */ const lodash_es_difference = (difference);
3362 
3363 ;// CONCATENATED MODULE: ../node_modules/lodash-es/compact.js
3364 /**
3365  * Creates an array with all falsey values removed. The values `false`, `null`,
3366  * `0`, `""`, `undefined`, and `NaN` are falsey.
3367  *
3368  * @static
3369  * @memberOf _
3370  * @since 0.1.0
3371  * @category Array
3372  * @param {Array} array The array to compact.
3373  * @returns {Array} Returns the new array of filtered values.
3374  * @example
3375  *
3376  * _.compact([0, 1, false, 2, '', 3]);
3377  * // => [1, 2, 3]
3378  */
3379 function compact(array) {
3380   var index = -1,
3381       length = array == null ? 0 : array.length,
3382       resIndex = 0,
3383       result = [];
3384 
3385   while (++index < length) {
3386     var value = array[index];
3387     if (value) {
3388       result[resIndex++] = value;
3389     }
3390   }
3391   return result;
3392 }
3393 
3394 /* harmony default export */ const lodash_es_compact = (compact);
3395 
3396 ;// CONCATENATED MODULE: ../node_modules/lodash-es/head.js
3397 /**
3398  * Gets the first element of `array`.
3399  *
3400  * @static
3401  * @memberOf _
3402  * @since 0.1.0
3403  * @alias first
3404  * @category Array
3405  * @param {Array} array The array to query.
3406  * @returns {*} Returns the first element of `array`.
3407  * @example
3408  *
3409  * _.head([1, 2, 3]);
3410  * // => 1
3411  *
3412  * _.head([]);
3413  * // => undefined
3414  */
3415 function head(array) {
3416   return (array && array.length) ? array[0] : undefined;
3417 }
3418 
3419 /* harmony default export */ const lodash_es_head = (head);
3420 
3421 // EXTERNAL MODULE: ../node_modules/lodash-es/find.js + 2 modules
3422 var find = __webpack_require__(90970);
3423 ;// CONCATENATED MODULE: ../node_modules/@chevrotain/utils/lib/src/print.js
3424 function PRINT_ERROR(msg) {
3425     /* istanbul ignore else - can't override global.console in node.js */
3426     if (console && console.error) {
3427         console.error(`Error: ${msg}`);
3428     }
3429 }
3430 function PRINT_WARNING(msg) {
3431     /* istanbul ignore else - can't override global.console in node.js*/
3432     if (console && console.warn) {
3433         // TODO: modify docs accordingly
3434         console.warn(`Warning: ${msg}`);
3435     }
3436 }
3437 //# sourceMappingURL=print.js.map
3438 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/scan/reg_exp_parser.js
3439 
3440 let regExpAstCache = {};
3441 const regExpParser = new api/* RegExpParser */.O();
3442 function getRegExpAst(regExp) {
3443     const regExpStr = regExp.toString();
3444     if (regExpAstCache.hasOwnProperty(regExpStr)) {
3445         return regExpAstCache[regExpStr];
3446     }
3447     else {
3448         const regExpAst = regExpParser.pattern(regExpStr);
3449         regExpAstCache[regExpStr] = regExpAst;
3450         return regExpAst;
3451     }
3452 }
3453 function clearRegExpParserCache() {
3454     regExpAstCache = {};
3455 }
3456 //# sourceMappingURL=reg_exp_parser.js.map
3457 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/scan/reg_exp.js
3458 
3459 
3460 
3461 
3462 
3463 const complementErrorMessage = "Complement Sets are not supported for first char optimization";
3464 const failedOptimizationPrefixMsg = 'Unable to use "first char" lexer optimizations:\n';
3465 function getOptimizedStartCodesIndices(regExp, ensureOptimizations = false) {
3466     try {
3467         const ast = getRegExpAst(regExp);
3468         const firstChars = firstCharOptimizedIndices(ast.value, {}, ast.flags.ignoreCase);
3469         return firstChars;
3470     }
3471     catch (e) {
3472         /* istanbul ignore next */
3473         // Testing this relies on the regexp-to-ast library having a bug... */
3474         // TODO: only the else branch needs to be ignored, try to fix with newer prettier / tsc
3475         if (e.message === complementErrorMessage) {
3476             if (ensureOptimizations) {
3477                 PRINT_WARNING(`${failedOptimizationPrefixMsg}` +
3478                     `\tUnable to optimize: < ${regExp.toString()} >\n` +
3479                     "\tComplement Sets cannot be automatically optimized.\n" +
3480                     "\tThis will disable the lexer's first char optimizations.\n" +
3481                     "\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.");
3482             }
3483         }
3484         else {
3485             let msgSuffix = "";
3486             if (ensureOptimizations) {
3487                 msgSuffix =
3488                     "\n\tThis will disable the lexer's first char optimizations.\n" +
3489                         "\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.";
3490             }
3491             PRINT_ERROR(`${failedOptimizationPrefixMsg}\n` +
3492                 `\tFailed parsing: < ${regExp.toString()} >\n` +
3493                 `\tUsing the @chevrotain/regexp-to-ast library\n` +
3494                 "\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues" +
3495                 msgSuffix);
3496         }
3497     }
3498     return [];
3499 }
3500 function firstCharOptimizedIndices(ast, result, ignoreCase) {
3501     switch (ast.type) {
3502         case "Disjunction":
3503             for (let i = 0; i < ast.value.length; i++) {
3504                 firstCharOptimizedIndices(ast.value[i], result, ignoreCase);
3505             }
3506             break;
3507         case "Alternative":
3508             const terms = ast.value;
3509             for (let i = 0; i < terms.length; i++) {
3510                 const term = terms[i];
3511                 // skip terms that cannot effect the first char results
3512                 switch (term.type) {
3513                     case "EndAnchor":
3514                     // A group back reference cannot affect potential starting char.
3515                     // because if a back reference is the first production than automatically
3516                     // the group being referenced has had to come BEFORE so its codes have already been added
3517                     case "GroupBackReference":
3518                     // assertions do not affect potential starting codes
3519                     case "Lookahead":
3520                     case "NegativeLookahead":
3521                     case "StartAnchor":
3522                     case "WordBoundary":
3523                     case "NonWordBoundary":
3524                         continue;
3525                 }
3526                 const atom = term;
3527                 switch (atom.type) {
3528                     case "Character":
3529                         addOptimizedIdxToResult(atom.value, result, ignoreCase);
3530                         break;
3531                     case "Set":
3532                         if (atom.complement === true) {
3533                             throw Error(complementErrorMessage);
3534                         }
3535                         (0,forEach/* default */.Z)(atom.value, (code) => {
3536                             if (typeof code === "number") {
3537                                 addOptimizedIdxToResult(code, result, ignoreCase);
3538                             }
3539                             else {
3540                                 // range
3541                                 const range = code;
3542                                 // cannot optimize when ignoreCase is
3543                                 if (ignoreCase === true) {
3544                                     for (let rangeCode = range.from; rangeCode <= range.to; rangeCode++) {
3545                                         addOptimizedIdxToResult(rangeCode, result, ignoreCase);
3546                                     }
3547                                 }
3548                                 // Optimization (2 orders of magnitude less work for very large ranges)
3549                                 else {
3550                                     // handle unoptimized values
3551                                     for (let rangeCode = range.from; rangeCode <= range.to && rangeCode < minOptimizationVal; rangeCode++) {
3552                                         addOptimizedIdxToResult(rangeCode, result, ignoreCase);
3553                                     }
3554                                     // Less common charCode where we optimize for faster init time, by using larger "buckets"
3555                                     if (range.to >= minOptimizationVal) {
3556                                         const minUnOptVal = range.from >= minOptimizationVal
3557                                             ? range.from
3558                                             : minOptimizationVal;
3559                                         const maxUnOptVal = range.to;
3560                                         const minOptIdx = charCodeToOptimizedIndex(minUnOptVal);
3561                                         const maxOptIdx = charCodeToOptimizedIndex(maxUnOptVal);
3562                                         for (let currOptIdx = minOptIdx; currOptIdx <= maxOptIdx; currOptIdx++) {
3563                                             result[currOptIdx] = currOptIdx;
3564                                         }
3565                                     }
3566                                 }
3567                             }
3568                         });
3569                         break;
3570                     case "Group":
3571                         firstCharOptimizedIndices(atom.value, result, ignoreCase);
3572                         break;
3573                     /* istanbul ignore next */
3574                     default:
3575                         throw Error("Non Exhaustive Match");
3576                 }
3577                 // reached a mandatory production, no more **start** codes can be found on this alternative
3578                 const isOptionalQuantifier = atom.quantifier !== undefined && atom.quantifier.atLeast === 0;
3579                 if (
3580                 // A group may be optional due to empty contents /(?:)/
3581                 // or if everything inside it is optional /((a)?)/
3582                 (atom.type === "Group" && isWholeOptional(atom) === false) ||
3583                     // If this term is not a group it may only be optional if it has an optional quantifier
3584                     (atom.type !== "Group" && isOptionalQuantifier === false)) {
3585                     break;
3586                 }
3587             }
3588             break;
3589         /* istanbul ignore next */
3590         default:
3591             throw Error("non exhaustive match!");
3592     }
3593     // console.log(Object.keys(result).length)
3594     return (0,values/* default */.Z)(result);
3595 }
3596 function addOptimizedIdxToResult(code, result, ignoreCase) {
3597     const optimizedCharIdx = charCodeToOptimizedIndex(code);
3598     result[optimizedCharIdx] = optimizedCharIdx;
3599     if (ignoreCase === true) {
3600         handleIgnoreCase(code, result);
3601     }
3602 }
3603 function handleIgnoreCase(code, result) {
3604     const char = String.fromCharCode(code);
3605     const upperChar = char.toUpperCase();
3606     /* istanbul ignore else */
3607     if (upperChar !== char) {
3608         const optimizedCharIdx = charCodeToOptimizedIndex(upperChar.charCodeAt(0));
3609         result[optimizedCharIdx] = optimizedCharIdx;
3610     }
3611     else {
3612         const lowerChar = char.toLowerCase();
3613         if (lowerChar !== char) {
3614             const optimizedCharIdx = charCodeToOptimizedIndex(lowerChar.charCodeAt(0));
3615             result[optimizedCharIdx] = optimizedCharIdx;
3616         }
3617     }
3618 }
3619 function findCode(setNode, targetCharCodes) {
3620     return (0,find/* default */.Z)(setNode.value, (codeOrRange) => {
3621         if (typeof codeOrRange === "number") {
3622             return lodash_es_includes(targetCharCodes, codeOrRange);
3623         }
3624         else {
3625             // range
3626             const range = codeOrRange;
3627             return ((0,find/* default */.Z)(targetCharCodes, (targetCode) => range.from <= targetCode && targetCode <= range.to) !== undefined);
3628         }
3629     });
3630 }
3631 function isWholeOptional(ast) {
3632     const quantifier = ast.quantifier;
3633     if (quantifier && quantifier.atLeast === 0) {
3634         return true;
3635     }
3636     if (!ast.value) {
3637         return false;
3638     }
3639     return (0,isArray/* default */.Z)(ast.value)
3640         ? lodash_es_every(ast.value, isWholeOptional)
3641         : isWholeOptional(ast.value);
3642 }
3643 class CharCodeFinder extends api/* BaseRegExpVisitor */.e {
3644     constructor(targetCharCodes) {
3645         super();
3646         this.targetCharCodes = targetCharCodes;
3647         this.found = false;
3648     }
3649     visitChildren(node) {
3650         // No need to keep looking...
3651         if (this.found === true) {
3652             return;
3653         }
3654         // switch lookaheads as they do not actually consume any characters thus
3655         // finding a charCode at lookahead context does not mean that regexp can actually contain it in a match.
3656         switch (node.type) {
3657             case "Lookahead":
3658                 this.visitLookahead(node);
3659                 return;
3660             case "NegativeLookahead":
3661                 this.visitNegativeLookahead(node);
3662                 return;
3663         }
3664         super.visitChildren(node);
3665     }
3666     visitCharacter(node) {
3667         if (lodash_es_includes(this.targetCharCodes, node.value)) {
3668             this.found = true;
3669         }
3670     }
3671     visitSet(node) {
3672         if (node.complement) {
3673             if (findCode(node, this.targetCharCodes) === undefined) {
3674                 this.found = true;
3675             }
3676         }
3677         else {
3678             if (findCode(node, this.targetCharCodes) !== undefined) {
3679                 this.found = true;
3680             }
3681         }
3682     }
3683 }
3684 function canMatchCharCode(charCodes, pattern) {
3685     if (pattern instanceof RegExp) {
3686         const ast = getRegExpAst(pattern);
3687         const charCodeFinder = new CharCodeFinder(charCodes);
3688         charCodeFinder.visit(ast);
3689         return charCodeFinder.found;
3690     }
3691     else {
3692         return ((0,find/* default */.Z)(pattern, (char) => {
3693             return lodash_es_includes(charCodes, char.charCodeAt(0));
3694         }) !== undefined);
3695     }
3696 }
3697 //# sourceMappingURL=reg_exp.js.map
3698 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/scan/lexer.js
3699 
3700 
3701 
3702 
3703 
3704 
3705 const PATTERN = "PATTERN";
3706 const DEFAULT_MODE = "defaultMode";
3707 const MODES = "modes";
3708 let SUPPORT_STICKY = typeof new RegExp("(?:)").sticky === "boolean";
3709 function disableSticky() {
3710     SUPPORT_STICKY = false;
3711 }
3712 function enableSticky() {
3713     SUPPORT_STICKY = true;
3714 }
3715 function analyzeTokenTypes(tokenTypes, options) {
3716     options = (0,defaults/* default */.Z)(options, {
3717         useSticky: SUPPORT_STICKY,
3718         debug: false,
3719         safeMode: false,
3720         positionTracking: "full",
3721         lineTerminatorCharacters: ["\r", "\n"],
3722         tracer: (msg, action) => action(),
3723     });
3724     const tracer = options.tracer;
3725     tracer("initCharCodeToOptimizedIndexMap", () => {
3726         initCharCodeToOptimizedIndexMap();
3727     });
3728     let onlyRelevantTypes;
3729     tracer("Reject Lexer.NA", () => {
3730         onlyRelevantTypes = lodash_es_reject(tokenTypes, (currType) => {
3731             return currType[PATTERN] === Lexer.NA;
3732         });
3733     });
3734     let hasCustom = false;
3735     let allTransformedPatterns;
3736     tracer("Transform Patterns", () => {
3737         hasCustom = false;
3738         allTransformedPatterns = (0,map/* default */.Z)(onlyRelevantTypes, (currType) => {
3739             const currPattern = currType[PATTERN];
3740             /* istanbul ignore else */
3741             if (lodash_es_isRegExp(currPattern)) {
3742                 const regExpSource = currPattern.source;
3743                 if (regExpSource.length === 1 &&
3744                     // only these regExp meta characters which can appear in a length one regExp
3745                     regExpSource !== "^" &&
3746                     regExpSource !== "$" &&
3747                     regExpSource !== "." &&
3748                     !currPattern.ignoreCase) {
3749                     return regExpSource;
3750                 }
3751                 else if (regExpSource.length === 2 &&
3752                     regExpSource[0] === "\\" &&
3753                     // not a meta character
3754                     !lodash_es_includes([
3755                         "d",
3756                         "D",
3757                         "s",
3758                         "S",
3759                         "t",
3760                         "r",
3761                         "n",
3762                         "t",
3763                         "0",
3764                         "c",
3765                         "b",
3766                         "B",
3767                         "f",
3768                         "v",
3769                         "w",
3770                         "W",
3771                     ], regExpSource[1])) {
3772                     // escaped meta Characters: /\+/ /\[/
3773                     // or redundant escaping: /\a/
3774                     // without the escaping "\"
3775                     return regExpSource[1];
3776                 }
3777                 else {
3778                     return options.useSticky
3779                         ? addStickyFlag(currPattern)
3780                         : addStartOfInput(currPattern);
3781                 }
3782             }
3783             else if ((0,isFunction/* default */.Z)(currPattern)) {
3784                 hasCustom = true;
3785                 // CustomPatternMatcherFunc - custom patterns do not require any transformations, only wrapping in a RegExp Like object
3786                 return { exec: currPattern };
3787             }
3788             else if (typeof currPattern === "object") {
3789                 hasCustom = true;
3790                 // ICustomPattern
3791                 return currPattern;
3792             }
3793             else if (typeof currPattern === "string") {
3794                 if (currPattern.length === 1) {
3795                     return currPattern;
3796                 }
3797                 else {
3798                     const escapedRegExpString = currPattern.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
3799                     const wrappedRegExp = new RegExp(escapedRegExpString);
3800                     return options.useSticky
3801                         ? addStickyFlag(wrappedRegExp)
3802                         : addStartOfInput(wrappedRegExp);
3803                 }
3804             }
3805             else {
3806                 throw Error("non exhaustive match");
3807             }
3808         });
3809     });
3810     let patternIdxToType;
3811     let patternIdxToGroup;
3812     let patternIdxToLongerAltIdxArr;
3813     let patternIdxToPushMode;
3814     let patternIdxToPopMode;
3815     tracer("misc mapping", () => {
3816         patternIdxToType = (0,map/* default */.Z)(onlyRelevantTypes, (currType) => currType.tokenTypeIdx);
3817         patternIdxToGroup = (0,map/* default */.Z)(onlyRelevantTypes, (clazz) => {
3818             const groupName = clazz.GROUP;
3819             /* istanbul ignore next */
3820             if (groupName === Lexer.SKIPPED) {
3821                 return undefined;
3822             }
3823             else if ((0,isString/* default */.Z)(groupName)) {
3824                 return groupName;
3825             }
3826             else if ((0,isUndefined/* default */.Z)(groupName)) {
3827                 return false;
3828             }
3829             else {
3830                 throw Error("non exhaustive match");
3831             }
3832         });
3833         patternIdxToLongerAltIdxArr = (0,map/* default */.Z)(onlyRelevantTypes, (clazz) => {
3834             const longerAltType = clazz.LONGER_ALT;
3835             if (longerAltType) {
3836                 const longerAltIdxArr = (0,isArray/* default */.Z)(longerAltType)
3837                     ? (0,map/* default */.Z)(longerAltType, (type) => lodash_es_indexOf(onlyRelevantTypes, type))
3838                     : [lodash_es_indexOf(onlyRelevantTypes, longerAltType)];
3839                 return longerAltIdxArr;
3840             }
3841         });
3842         patternIdxToPushMode = (0,map/* default */.Z)(onlyRelevantTypes, (clazz) => clazz.PUSH_MODE);
3843         patternIdxToPopMode = (0,map/* default */.Z)(onlyRelevantTypes, (clazz) => (0,has/* default */.Z)(clazz, "POP_MODE"));
3844     });
3845     let patternIdxToCanLineTerminator;
3846     tracer("Line Terminator Handling", () => {
3847         const lineTerminatorCharCodes = getCharCodes(options.lineTerminatorCharacters);
3848         patternIdxToCanLineTerminator = (0,map/* default */.Z)(onlyRelevantTypes, (tokType) => false);
3849         if (options.positionTracking !== "onlyOffset") {
3850             patternIdxToCanLineTerminator = (0,map/* default */.Z)(onlyRelevantTypes, (tokType) => {
3851                 if ((0,has/* default */.Z)(tokType, "LINE_BREAKS")) {
3852                     return !!tokType.LINE_BREAKS;
3853                 }
3854                 else {
3855                     return (checkLineBreaksIssues(tokType, lineTerminatorCharCodes) === false &&
3856                         canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN));
3857                 }
3858             });
3859         }
3860     });
3861     let patternIdxToIsCustom;
3862     let patternIdxToShort;
3863     let emptyGroups;
3864     let patternIdxToConfig;
3865     tracer("Misc Mapping #2", () => {
3866         patternIdxToIsCustom = (0,map/* default */.Z)(onlyRelevantTypes, isCustomPattern);
3867         patternIdxToShort = (0,map/* default */.Z)(allTransformedPatterns, isShortPattern);
3868         emptyGroups = (0,reduce/* default */.Z)(onlyRelevantTypes, (acc, clazz) => {
3869             const groupName = clazz.GROUP;
3870             if ((0,isString/* default */.Z)(groupName) && !(groupName === Lexer.SKIPPED)) {
3871                 acc[groupName] = [];
3872             }
3873             return acc;
3874         }, {});
3875         patternIdxToConfig = (0,map/* default */.Z)(allTransformedPatterns, (x, idx) => {
3876             return {
3877                 pattern: allTransformedPatterns[idx],
3878                 longerAlt: patternIdxToLongerAltIdxArr[idx],
3879                 canLineTerminator: patternIdxToCanLineTerminator[idx],
3880                 isCustom: patternIdxToIsCustom[idx],
3881                 short: patternIdxToShort[idx],
3882                 group: patternIdxToGroup[idx],
3883                 push: patternIdxToPushMode[idx],
3884                 pop: patternIdxToPopMode[idx],
3885                 tokenTypeIdx: patternIdxToType[idx],
3886                 tokenType: onlyRelevantTypes[idx],
3887             };
3888         });
3889     });
3890     let canBeOptimized = true;
3891     let charCodeToPatternIdxToConfig = [];
3892     if (!options.safeMode) {
3893         tracer("First Char Optimization", () => {
3894             charCodeToPatternIdxToConfig = (0,reduce/* default */.Z)(onlyRelevantTypes, (result, currTokType, idx) => {
3895                 if (typeof currTokType.PATTERN === "string") {
3896                     const charCode = currTokType.PATTERN.charCodeAt(0);
3897                     const optimizedIdx = charCodeToOptimizedIndex(charCode);
3898                     addToMapOfArrays(result, optimizedIdx, patternIdxToConfig[idx]);
3899                 }
3900                 else if ((0,isArray/* default */.Z)(currTokType.START_CHARS_HINT)) {
3901                     let lastOptimizedIdx;
3902                     (0,forEach/* default */.Z)(currTokType.START_CHARS_HINT, (charOrInt) => {
3903                         const charCode = typeof charOrInt === "string"
3904                             ? charOrInt.charCodeAt(0)
3905                             : charOrInt;
3906                         const currOptimizedIdx = charCodeToOptimizedIndex(charCode);
3907                         // Avoid adding the config multiple times
3908                         /* istanbul ignore else */
3909                         // - Difficult to check this scenario effects as it is only a performance
3910                         //   optimization that does not change correctness
3911                         if (lastOptimizedIdx !== currOptimizedIdx) {
3912                             lastOptimizedIdx = currOptimizedIdx;
3913                             addToMapOfArrays(result, currOptimizedIdx, patternIdxToConfig[idx]);
3914                         }
3915                     });
3916                 }
3917                 else if (lodash_es_isRegExp(currTokType.PATTERN)) {
3918                     if (currTokType.PATTERN.unicode) {
3919                         canBeOptimized = false;
3920                         if (options.ensureOptimizations) {
3921                             PRINT_ERROR(`${failedOptimizationPrefixMsg}` +
3922                                 `\tUnable to analyze < ${currTokType.PATTERN.toString()} > pattern.\n` +
3923                                 "\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n" +
3924                                 "\tThis will disable the lexer's first char optimizations.\n" +
3925                                 "\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE");
3926                         }
3927                     }
3928                     else {
3929                         const optimizedCodes = getOptimizedStartCodesIndices(currTokType.PATTERN, options.ensureOptimizations);
3930                         /* istanbul ignore if */
3931                         // start code will only be empty given an empty regExp or failure of regexp-to-ast library
3932                         // the first should be a different validation and the second cannot be tested.
3933                         if ((0,isEmpty/* default */.Z)(optimizedCodes)) {
3934                             // we cannot understand what codes may start possible matches
3935                             // The optimization correctness requires knowing start codes for ALL patterns.
3936                             // Not actually sure this is an error, no debug message
3937                             canBeOptimized = false;
3938                         }
3939                         (0,forEach/* default */.Z)(optimizedCodes, (code) => {
3940                             addToMapOfArrays(result, code, patternIdxToConfig[idx]);
3941                         });
3942                     }
3943                 }
3944                 else {
3945                     if (options.ensureOptimizations) {
3946                         PRINT_ERROR(`${failedOptimizationPrefixMsg}` +
3947                             `\tTokenType: <${currTokType.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n` +
3948                             "\tThis will disable the lexer's first char optimizations.\n" +
3949                             "\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE");
3950                     }
3951                     canBeOptimized = false;
3952                 }
3953                 return result;
3954             }, []);
3955         });
3956     }
3957     return {
3958         emptyGroups: emptyGroups,
3959         patternIdxToConfig: patternIdxToConfig,
3960         charCodeToPatternIdxToConfig: charCodeToPatternIdxToConfig,
3961         hasCustom: hasCustom,
3962         canBeOptimized: canBeOptimized,
3963     };
3964 }
3965 function validatePatterns(tokenTypes, validModesNames) {
3966     let errors = [];
3967     const missingResult = findMissingPatterns(tokenTypes);
3968     errors = errors.concat(missingResult.errors);
3969     const invalidResult = findInvalidPatterns(missingResult.valid);
3970     const validTokenTypes = invalidResult.valid;
3971     errors = errors.concat(invalidResult.errors);
3972     errors = errors.concat(validateRegExpPattern(validTokenTypes));
3973     errors = errors.concat(findInvalidGroupType(validTokenTypes));
3974     errors = errors.concat(findModesThatDoNotExist(validTokenTypes, validModesNames));
3975     errors = errors.concat(findUnreachablePatterns(validTokenTypes));
3976     return errors;
3977 }
3978 function validateRegExpPattern(tokenTypes) {
3979     let errors = [];
3980     const withRegExpPatterns = (0,filter/* default */.Z)(tokenTypes, (currTokType) => lodash_es_isRegExp(currTokType[PATTERN]));
3981     errors = errors.concat(findEndOfInputAnchor(withRegExpPatterns));
3982     errors = errors.concat(findStartOfInputAnchor(withRegExpPatterns));
3983     errors = errors.concat(findUnsupportedFlags(withRegExpPatterns));
3984     errors = errors.concat(findDuplicatePatterns(withRegExpPatterns));
3985     errors = errors.concat(findEmptyMatchRegExps(withRegExpPatterns));
3986     return errors;
3987 }
3988 function findMissingPatterns(tokenTypes) {
3989     const tokenTypesWithMissingPattern = (0,filter/* default */.Z)(tokenTypes, (currType) => {
3990         return !(0,has/* default */.Z)(currType, PATTERN);
3991     });
3992     const errors = (0,map/* default */.Z)(tokenTypesWithMissingPattern, (currType) => {
3993         return {
3994             message: "Token Type: ->" +
3995                 currType.name +
3996                 "<- missing static 'PATTERN' property",
3997             type: LexerDefinitionErrorType.MISSING_PATTERN,
3998             tokenTypes: [currType],
3999         };
4000     });
4001     const valid = lodash_es_difference(tokenTypes, tokenTypesWithMissingPattern);
4002     return { errors, valid };
4003 }
4004 function findInvalidPatterns(tokenTypes) {
4005     const tokenTypesWithInvalidPattern = (0,filter/* default */.Z)(tokenTypes, (currType) => {
4006         const pattern = currType[PATTERN];
4007         return (!lodash_es_isRegExp(pattern) &&
4008             !(0,isFunction/* default */.Z)(pattern) &&
4009             !(0,has/* default */.Z)(pattern, "exec") &&
4010             !(0,isString/* default */.Z)(pattern));
4011     });
4012     const errors = (0,map/* default */.Z)(tokenTypesWithInvalidPattern, (currType) => {
4013         return {
4014             message: "Token Type: ->" +
4015                 currType.name +
4016                 "<- static 'PATTERN' can only be a RegExp, a" +
4017                 " Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",
4018             type: LexerDefinitionErrorType.INVALID_PATTERN,
4019             tokenTypes: [currType],
4020         };
4021     });
4022     const valid = lodash_es_difference(tokenTypes, tokenTypesWithInvalidPattern);
4023     return { errors, valid };
4024 }
4025 const end_of_input = /[^\\][$]/;
4026 function findEndOfInputAnchor(tokenTypes) {
4027     class EndAnchorFinder extends api/* BaseRegExpVisitor */.e {
4028         constructor() {
4029             super(...arguments);
4030             this.found = false;
4031         }
4032         visitEndAnchor(node) {
4033             this.found = true;
4034         }
4035     }
4036     const invalidRegex = (0,filter/* default */.Z)(tokenTypes, (currType) => {
4037         const pattern = currType.PATTERN;
4038         try {
4039             const regexpAst = getRegExpAst(pattern);
4040             const endAnchorVisitor = new EndAnchorFinder();
4041             endAnchorVisitor.visit(regexpAst);
4042             return endAnchorVisitor.found;
4043         }
4044         catch (e) {
4045             // old behavior in case of runtime exceptions with regexp-to-ast.
4046             /* istanbul ignore next - cannot ensure an error in regexp-to-ast*/
4047             return end_of_input.test(pattern.source);
4048         }
4049     });
4050     const errors = (0,map/* default */.Z)(invalidRegex, (currType) => {
4051         return {
4052             message: "Unexpected RegExp Anchor Error:\n" +
4053                 "\tToken Type: ->" +
4054                 currType.name +
4055                 "<- static 'PATTERN' cannot contain end of input anchor '$'\n" +
4056                 "\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS" +
4057                 "\tfor details.",
4058             type: LexerDefinitionErrorType.EOI_ANCHOR_FOUND,
4059             tokenTypes: [currType],
4060         };
4061     });
4062     return errors;
4063 }
4064 function findEmptyMatchRegExps(tokenTypes) {
4065     const matchesEmptyString = (0,filter/* default */.Z)(tokenTypes, (currType) => {
4066         const pattern = currType.PATTERN;
4067         return pattern.test("");
4068     });
4069     const errors = (0,map/* default */.Z)(matchesEmptyString, (currType) => {
4070         return {
4071             message: "Token Type: ->" +
4072                 currType.name +
4073                 "<- static 'PATTERN' must not match an empty string",
4074             type: LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,
4075             tokenTypes: [currType],
4076         };
4077     });
4078     return errors;
4079 }
4080 const start_of_input = /[^\\[][\^]|^\^/;
4081 function findStartOfInputAnchor(tokenTypes) {
4082     class StartAnchorFinder extends api/* BaseRegExpVisitor */.e {
4083         constructor() {
4084             super(...arguments);
4085             this.found = false;
4086         }
4087         visitStartAnchor(node) {
4088             this.found = true;
4089         }
4090     }
4091     const invalidRegex = (0,filter/* default */.Z)(tokenTypes, (currType) => {
4092         const pattern = currType.PATTERN;
4093         try {
4094             const regexpAst = getRegExpAst(pattern);
4095             const startAnchorVisitor = new StartAnchorFinder();
4096             startAnchorVisitor.visit(regexpAst);
4097             return startAnchorVisitor.found;
4098         }
4099         catch (e) {
4100             // old behavior in case of runtime exceptions with regexp-to-ast.
4101             /* istanbul ignore next - cannot ensure an error in regexp-to-ast*/
4102             return start_of_input.test(pattern.source);
4103         }
4104     });
4105     const errors = (0,map/* default */.Z)(invalidRegex, (currType) => {
4106         return {
4107             message: "Unexpected RegExp Anchor Error:\n" +
4108                 "\tToken Type: ->" +
4109                 currType.name +
4110                 "<- static 'PATTERN' cannot contain start of input anchor '^'\n" +
4111                 "\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS" +
4112                 "\tfor details.",
4113             type: LexerDefinitionErrorType.SOI_ANCHOR_FOUND,
4114             tokenTypes: [currType],
4115         };
4116     });
4117     return errors;
4118 }
4119 function findUnsupportedFlags(tokenTypes) {
4120     const invalidFlags = (0,filter/* default */.Z)(tokenTypes, (currType) => {
4121         const pattern = currType[PATTERN];
4122         return pattern instanceof RegExp && (pattern.multiline || pattern.global);
4123     });
4124     const errors = (0,map/* default */.Z)(invalidFlags, (currType) => {
4125         return {
4126             message: "Token Type: ->" +
4127                 currType.name +
4128                 "<- static 'PATTERN' may NOT contain global('g') or multiline('m')",
4129             type: LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,
4130             tokenTypes: [currType],
4131         };
4132     });
4133     return errors;
4134 }
4135 // This can only test for identical duplicate RegExps, not semantically equivalent ones.
4136 function findDuplicatePatterns(tokenTypes) {
4137     const found = [];
4138     let identicalPatterns = (0,map/* default */.Z)(tokenTypes, (outerType) => {
4139         return (0,reduce/* default */.Z)(tokenTypes, (result, innerType) => {
4140             if (outerType.PATTERN.source === innerType.PATTERN.source &&
4141                 !lodash_es_includes(found, innerType) &&
4142                 innerType.PATTERN !== Lexer.NA) {
4143                 // this avoids duplicates in the result, each Token Type may only appear in one "set"
4144                 // in essence we are creating Equivalence classes on equality relation.
4145                 found.push(innerType);
4146                 result.push(innerType);
4147                 return result;
4148             }
4149             return result;
4150         }, []);
4151     });
4152     identicalPatterns = lodash_es_compact(identicalPatterns);
4153     const duplicatePatterns = (0,filter/* default */.Z)(identicalPatterns, (currIdenticalSet) => {
4154         return currIdenticalSet.length > 1;
4155     });
4156     const errors = (0,map/* default */.Z)(duplicatePatterns, (setOfIdentical) => {
4157         const tokenTypeNames = (0,map/* default */.Z)(setOfIdentical, (currType) => {
4158             return currType.name;
4159         });
4160         const dupPatternSrc = lodash_es_head(setOfIdentical).PATTERN;
4161         return {
4162             message: `The same RegExp pattern ->${dupPatternSrc}<-` +
4163                 `has been used in all of the following Token Types: ${tokenTypeNames.join(", ")} <-`,
4164             type: LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,
4165             tokenTypes: setOfIdentical,
4166         };
4167     });
4168     return errors;
4169 }
4170 function findInvalidGroupType(tokenTypes) {
4171     const invalidTypes = (0,filter/* default */.Z)(tokenTypes, (clazz) => {
4172         if (!(0,has/* default */.Z)(clazz, "GROUP")) {
4173             return false;
4174         }
4175         const group = clazz.GROUP;
4176         return group !== Lexer.SKIPPED && group !== Lexer.NA && !(0,isString/* default */.Z)(group);
4177     });
4178     const errors = (0,map/* default */.Z)(invalidTypes, (currType) => {
4179         return {
4180             message: "Token Type: ->" +
4181                 currType.name +
4182                 "<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",
4183             type: LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,
4184             tokenTypes: [currType],
4185         };
4186     });
4187     return errors;
4188 }
4189 function findModesThatDoNotExist(tokenTypes, validModes) {
4190     const invalidModes = (0,filter/* default */.Z)(tokenTypes, (clazz) => {
4191         return (clazz.PUSH_MODE !== undefined && !lodash_es_includes(validModes, clazz.PUSH_MODE));
4192     });
4193     const errors = (0,map/* default */.Z)(invalidModes, (tokType) => {
4194         const msg = `Token Type: ->${tokType.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${tokType.PUSH_MODE}<-` +
4195             `which does not exist`;
4196         return {
4197             message: msg,
4198             type: LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,
4199             tokenTypes: [tokType],
4200         };
4201     });
4202     return errors;
4203 }
4204 function findUnreachablePatterns(tokenTypes) {
4205     const errors = [];
4206     const canBeTested = (0,reduce/* default */.Z)(tokenTypes, (result, tokType, idx) => {
4207         const pattern = tokType.PATTERN;
4208         if (pattern === Lexer.NA) {
4209             return result;
4210         }
4211         // a more comprehensive validation for all forms of regExps would require
4212         // deeper regExp analysis capabilities
4213         if ((0,isString/* default */.Z)(pattern)) {
4214             result.push({ str: pattern, idx, tokenType: tokType });
4215         }
4216         else if (lodash_es_isRegExp(pattern) && noMetaChar(pattern)) {
4217             result.push({ str: pattern.source, idx, tokenType: tokType });
4218         }
4219         return result;
4220     }, []);
4221     (0,forEach/* default */.Z)(tokenTypes, (tokType, testIdx) => {
4222         (0,forEach/* default */.Z)(canBeTested, ({ str, idx, tokenType }) => {
4223             if (testIdx < idx && testTokenType(str, tokType.PATTERN)) {
4224                 const msg = `Token: ->${tokenType.name}<- can never be matched.\n` +
4225                     `Because it appears AFTER the Token Type ->${tokType.name}<-` +
4226                     `in the lexer's definition.\n` +
4227                     `See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;
4228                 errors.push({
4229                     message: msg,
4230                     type: LexerDefinitionErrorType.UNREACHABLE_PATTERN,
4231                     tokenTypes: [tokType, tokenType],
4232                 });
4233             }
4234         });
4235     });
4236     return errors;
4237 }
4238 function testTokenType(str, pattern) {
4239     /* istanbul ignore else */
4240     if (lodash_es_isRegExp(pattern)) {
4241         const regExpArray = pattern.exec(str);
4242         return regExpArray !== null && regExpArray.index === 0;
4243     }
4244     else if ((0,isFunction/* default */.Z)(pattern)) {
4245         // maintain the API of custom patterns
4246         return pattern(str, 0, [], {});
4247     }
4248     else if ((0,has/* default */.Z)(pattern, "exec")) {
4249         // maintain the API of custom patterns
4250         return pattern.exec(str, 0, [], {});
4251     }
4252     else if (typeof pattern === "string") {
4253         return pattern === str;
4254     }
4255     else {
4256         throw Error("non exhaustive match");
4257     }
4258 }
4259 function noMetaChar(regExp) {
4260     //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
4261     const metaChars = [
4262         ".",
4263         "\\",
4264         "[",
4265         "]",
4266         "|",
4267         "^",
4268         "$",
4269         "(",
4270         ")",
4271         "?",
4272         "*",
4273         "+",
4274         "{",
4275     ];
4276     return ((0,find/* default */.Z)(metaChars, (char) => regExp.source.indexOf(char) !== -1) === undefined);
4277 }
4278 function addStartOfInput(pattern) {
4279     const flags = pattern.ignoreCase ? "i" : "";
4280     // always wrapping in a none capturing group preceded by '^' to make sure matching can only work on start of input.
4281     // duplicate/redundant start of input markers have no meaning (/^^^^A/ === /^A/)
4282     return new RegExp(`^(?:${pattern.source})`, flags);
4283 }
4284 function addStickyFlag(pattern) {
4285     const flags = pattern.ignoreCase ? "iy" : "y";
4286     // always wrapping in a none capturing group preceded by '^' to make sure matching can only work on start of input.
4287     // duplicate/redundant start of input markers have no meaning (/^^^^A/ === /^A/)
4288     return new RegExp(`${pattern.source}`, flags);
4289 }
4290 function performRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) {
4291     const errors = [];
4292     // some run time checks to help the end users.
4293     if (!(0,has/* default */.Z)(lexerDefinition, DEFAULT_MODE)) {
4294         errors.push({
4295             message: "A MultiMode Lexer cannot be initialized without a <" +
4296                 DEFAULT_MODE +
4297                 "> property in its definition\n",
4298             type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE,
4299         });
4300     }
4301     if (!(0,has/* default */.Z)(lexerDefinition, MODES)) {
4302         errors.push({
4303             message: "A MultiMode Lexer cannot be initialized without a <" +
4304                 MODES +
4305                 "> property in its definition\n",
4306             type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY,
4307         });
4308     }
4309     if ((0,has/* default */.Z)(lexerDefinition, MODES) &&
4310         (0,has/* default */.Z)(lexerDefinition, DEFAULT_MODE) &&
4311         !(0,has/* default */.Z)(lexerDefinition.modes, lexerDefinition.defaultMode)) {
4312         errors.push({
4313             message: `A MultiMode Lexer cannot be initialized with a ${DEFAULT_MODE}: <${lexerDefinition.defaultMode}>` +
4314                 `which does not exist\n`,
4315             type: LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST,
4316         });
4317     }
4318     if ((0,has/* default */.Z)(lexerDefinition, MODES)) {
4319         (0,forEach/* default */.Z)(lexerDefinition.modes, (currModeValue, currModeName) => {
4320             (0,forEach/* default */.Z)(currModeValue, (currTokType, currIdx) => {
4321                 if ((0,isUndefined/* default */.Z)(currTokType)) {
4322                     errors.push({
4323                         message: `A Lexer cannot be initialized using an undefined Token Type. Mode:` +
4324                             `<${currModeName}> at index: <${currIdx}>\n`,
4325                         type: LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED,
4326                     });
4327                 }
4328                 else if ((0,has/* default */.Z)(currTokType, "LONGER_ALT")) {
4329                     const longerAlt = (0,isArray/* default */.Z)(currTokType.LONGER_ALT)
4330                         ? currTokType.LONGER_ALT
4331                         : [currTokType.LONGER_ALT];
4332                     (0,forEach/* default */.Z)(longerAlt, (currLongerAlt) => {
4333                         if (!(0,isUndefined/* default */.Z)(currLongerAlt) &&
4334                             !lodash_es_includes(currModeValue, currLongerAlt)) {
4335                             errors.push({
4336                                 message: `A MultiMode Lexer cannot be initialized with a longer_alt <${currLongerAlt.name}> on token <${currTokType.name}> outside of mode <${currModeName}>\n`,
4337                                 type: LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE,
4338                             });
4339                         }
4340                     });
4341                 }
4342             });
4343         });
4344     }
4345     return errors;
4346 }
4347 function performWarningRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) {
4348     const warnings = [];
4349     let hasAnyLineBreak = false;
4350     const allTokenTypes = lodash_es_compact((0,flatten/* default */.Z)((0,values/* default */.Z)(lexerDefinition.modes)));
4351     const concreteTokenTypes = lodash_es_reject(allTokenTypes, (currType) => currType[PATTERN] === Lexer.NA);
4352     const terminatorCharCodes = getCharCodes(lineTerminatorCharacters);
4353     if (trackLines) {
4354         (0,forEach/* default */.Z)(concreteTokenTypes, (tokType) => {
4355             const currIssue = checkLineBreaksIssues(tokType, terminatorCharCodes);
4356             if (currIssue !== false) {
4357                 const message = buildLineBreakIssueMessage(tokType, currIssue);
4358                 const warningDescriptor = {
4359                     message,
4360                     type: currIssue.issue,
4361                     tokenType: tokType,
4362                 };
4363                 warnings.push(warningDescriptor);
4364             }
4365             else {
4366                 // we don't want to attempt to scan if the user explicitly specified the line_breaks option.
4367                 if ((0,has/* default */.Z)(tokType, "LINE_BREAKS")) {
4368                     if (tokType.LINE_BREAKS === true) {
4369                         hasAnyLineBreak = true;
4370                     }
4371                 }
4372                 else {
4373                     if (canMatchCharCode(terminatorCharCodes, tokType.PATTERN)) {
4374                         hasAnyLineBreak = true;
4375                     }
4376                 }
4377             }
4378         });
4379     }
4380     if (trackLines && !hasAnyLineBreak) {
4381         warnings.push({
4382             message: "Warning: No LINE_BREAKS Found.\n" +
4383                 "\tThis Lexer has been defined to track line and column information,\n" +
4384                 "\tBut none of the Token Types can be identified as matching a line terminator.\n" +
4385                 "\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n" +
4386                 "\tfor details.",
4387             type: LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS,
4388         });
4389     }
4390     return warnings;
4391 }
4392 function cloneEmptyGroups(emptyGroups) {
4393     const clonedResult = {};
4394     const groupKeys = (0,keys/* default */.Z)(emptyGroups);
4395     (0,forEach/* default */.Z)(groupKeys, (currKey) => {
4396         const currGroupValue = emptyGroups[currKey];
4397         /* istanbul ignore else */
4398         if ((0,isArray/* default */.Z)(currGroupValue)) {
4399             clonedResult[currKey] = [];
4400         }
4401         else {
4402             throw Error("non exhaustive match");
4403         }
4404     });
4405     return clonedResult;
4406 }
4407 // TODO: refactor to avoid duplication
4408 function isCustomPattern(tokenType) {
4409     const pattern = tokenType.PATTERN;
4410     /* istanbul ignore else */
4411     if (lodash_es_isRegExp(pattern)) {
4412         return false;
4413     }
4414     else if ((0,isFunction/* default */.Z)(pattern)) {
4415         // CustomPatternMatcherFunc - custom patterns do not require any transformations, only wrapping in a RegExp Like object
4416         return true;
4417     }
4418     else if ((0,has/* default */.Z)(pattern, "exec")) {
4419         // ICustomPattern
4420         return true;
4421     }
4422     else if ((0,isString/* default */.Z)(pattern)) {
4423         return false;
4424     }
4425     else {
4426         throw Error("non exhaustive match");
4427     }
4428 }
4429 function isShortPattern(pattern) {
4430     if ((0,isString/* default */.Z)(pattern) && pattern.length === 1) {
4431         return pattern.charCodeAt(0);
4432     }
4433     else {
4434         return false;
4435     }
4436 }
4437 /**
4438  * Faster than using a RegExp for default newline detection during lexing.
4439  */
4440 const LineTerminatorOptimizedTester = {
4441     // implements /\n|\r\n?/g.test
4442     test: function (text) {
4443         const len = text.length;
4444         for (let i = this.lastIndex; i < len; i++) {
4445             const c = text.charCodeAt(i);
4446             if (c === 10) {
4447                 this.lastIndex = i + 1;
4448                 return true;
4449             }
4450             else if (c === 13) {
4451                 if (text.charCodeAt(i + 1) === 10) {
4452                     this.lastIndex = i + 2;
4453                 }
4454                 else {
4455                     this.lastIndex = i + 1;
4456                 }
4457                 return true;
4458             }
4459         }
4460         return false;
4461     },
4462     lastIndex: 0,
4463 };
4464 function checkLineBreaksIssues(tokType, lineTerminatorCharCodes) {
4465     if ((0,has/* default */.Z)(tokType, "LINE_BREAKS")) {
4466         // if the user explicitly declared the line_breaks option we will respect their choice
4467         // and assume it is correct.
4468         return false;
4469     }
4470     else {
4471         /* istanbul ignore else */
4472         if (lodash_es_isRegExp(tokType.PATTERN)) {
4473             try {
4474                 // TODO: why is the casting suddenly needed?
4475                 canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN);
4476             }
4477             catch (e) {
4478                 /* istanbul ignore next - to test this we would have to mock <canMatchCharCode> to throw an error */
4479                 return {
4480                     issue: LexerDefinitionErrorType.IDENTIFY_TERMINATOR,
4481                     errMsg: e.message,
4482                 };
4483             }
4484             return false;
4485         }
4486         else if ((0,isString/* default */.Z)(tokType.PATTERN)) {
4487             // string literal patterns can always be analyzed to detect line terminator usage
4488             return false;
4489         }
4490         else if (isCustomPattern(tokType)) {
4491             // custom token types
4492             return { issue: LexerDefinitionErrorType.CUSTOM_LINE_BREAK };
4493         }
4494         else {
4495             throw Error("non exhaustive match");
4496         }
4497     }
4498 }
4499 function buildLineBreakIssueMessage(tokType, details) {
4500     /* istanbul ignore else */
4501     if (details.issue === LexerDefinitionErrorType.IDENTIFY_TERMINATOR) {
4502         return ("Warning: unable to identify line terminator usage in pattern.\n" +
4503             `\tThe problem is in the <${tokType.name}> Token Type\n` +
4504             `\t Root cause: ${details.errMsg}.\n` +
4505             "\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR");
4506     }
4507     else if (details.issue === LexerDefinitionErrorType.CUSTOM_LINE_BREAK) {
4508         return ("Warning: A Custom Token Pattern should specify the <line_breaks> option.\n" +
4509             `\tThe problem is in the <${tokType.name}> Token Type\n` +
4510             "\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK");
4511     }
4512     else {
4513         throw Error("non exhaustive match");
4514     }
4515 }
4516 function getCharCodes(charsOrCodes) {
4517     const charCodes = (0,map/* default */.Z)(charsOrCodes, (numOrString) => {
4518         if ((0,isString/* default */.Z)(numOrString)) {
4519             return numOrString.charCodeAt(0);
4520         }
4521         else {
4522             return numOrString;
4523         }
4524     });
4525     return charCodes;
4526 }
4527 function addToMapOfArrays(map, key, value) {
4528     if (map[key] === undefined) {
4529         map[key] = [value];
4530     }
4531     else {
4532         map[key].push(value);
4533     }
4534 }
4535 const minOptimizationVal = 256;
4536 /**
4537  * We are mapping charCode above ASCI (256) into buckets each in the size of 256.
4538  * This is because ASCI are the most common start chars so each one of those will get its own
4539  * possible token configs vector.
4540  *
4541  * Tokens starting with charCodes "above" ASCI are uncommon, so we can "afford"
4542  * to place these into buckets of possible token configs, What we gain from
4543  * this is avoiding the case of creating an optimization 'charCodeToPatternIdxToConfig'
4544  * which would contain 10,000+ arrays of small size (e.g unicode Identifiers scenario).
4545  * Our 'charCodeToPatternIdxToConfig' max size will now be:
4546  * 256 + (2^16 / 2^8) - 1 === 511
4547  *
4548  * note the hack for fast division integer part extraction
4549  * See: https://stackoverflow.com/a/4228528
4550  */
4551 let charCodeToOptimizedIdxMap = [];
4552 function charCodeToOptimizedIndex(charCode) {
4553     return charCode < minOptimizationVal
4554         ? charCode
4555         : charCodeToOptimizedIdxMap[charCode];
4556 }
4557 /**
4558  * This is a compromise between cold start / hot running performance
4559  * Creating this array takes ~3ms on a modern machine,
4560  * But if we perform the computation at runtime as needed the CSS Lexer benchmark
4561  * performance degrades by ~10%
4562  *
4563  * TODO: Perhaps it should be lazy initialized only if a charCode > 255 is used.
4564  */
4565 function initCharCodeToOptimizedIndexMap() {
4566     if ((0,isEmpty/* default */.Z)(charCodeToOptimizedIdxMap)) {
4567         charCodeToOptimizedIdxMap = new Array(65536);
4568         for (let i = 0; i < 65536; i++) {
4569             charCodeToOptimizedIdxMap[i] = i > 255 ? 255 + ~~(i / 255) : i;
4570         }
4571     }
4572 }
4573 //# sourceMappingURL=lexer.js.map
4574 // EXTERNAL MODULE: ../node_modules/lodash-es/identity.js
4575 var identity = __webpack_require__(64056);
4576 // EXTERNAL MODULE: ../node_modules/lodash-es/noop.js
4577 var noop = __webpack_require__(10152);
4578 // EXTERNAL MODULE: ../node_modules/lodash-es/last.js
4579 var last = __webpack_require__(36411);
4580 ;// CONCATENATED MODULE: ../node_modules/@chevrotain/utils/lib/src/timer.js
4581 function timer(func) {
4582     const start = new Date().getTime();
4583     const val = func();
4584     const end = new Date().getTime();
4585     const total = end - start;
4586     return { time: total, value: val };
4587 }
4588 //# sourceMappingURL=timer.js.map
4589 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/scan/tokens.js
4590 
4591 function tokenStructuredMatcher(tokInstance, tokConstructor) {
4592     const instanceType = tokInstance.tokenTypeIdx;
4593     if (instanceType === tokConstructor.tokenTypeIdx) {
4594         return true;
4595     }
4596     else {
4597         return (tokConstructor.isParent === true &&
4598             tokConstructor.categoryMatchesMap[instanceType] === true);
4599     }
4600 }
4601 // Optimized tokenMatcher in case our grammar does not use token categories
4602 // Being so tiny it is much more likely to be in-lined and this avoid the function call overhead
4603 function tokenStructuredMatcherNoCategories(token, tokType) {
4604     return token.tokenTypeIdx === tokType.tokenTypeIdx;
4605 }
4606 let tokenShortNameIdx = 1;
4607 const tokenIdxToClass = {};
4608 function augmentTokenTypes(tokenTypes) {
4609     // collect the parent Token Types as well.
4610     const tokenTypesAndParents = expandCategories(tokenTypes);
4611     // add required tokenType and categoryMatches properties
4612     assignTokenDefaultProps(tokenTypesAndParents);
4613     // fill up the categoryMatches
4614     assignCategoriesMapProp(tokenTypesAndParents);
4615     assignCategoriesTokensProp(tokenTypesAndParents);
4616     (0,forEach/* default */.Z)(tokenTypesAndParents, (tokType) => {
4617         tokType.isParent = tokType.categoryMatches.length > 0;
4618     });
4619 }
4620 function expandCategories(tokenTypes) {
4621     let result = (0,lodash_es_clone/* default */.Z)(tokenTypes);
4622     let categories = tokenTypes;
4623     let searching = true;
4624     while (searching) {
4625         categories = lodash_es_compact((0,flatten/* default */.Z)((0,map/* default */.Z)(categories, (currTokType) => currTokType.CATEGORIES)));
4626         const newCategories = lodash_es_difference(categories, result);
4627         result = result.concat(newCategories);
4628         if ((0,isEmpty/* default */.Z)(newCategories)) {
4629             searching = false;
4630         }
4631         else {
4632             categories = newCategories;
4633         }
4634     }
4635     return result;
4636 }
4637 function assignTokenDefaultProps(tokenTypes) {
4638     (0,forEach/* default */.Z)(tokenTypes, (currTokType) => {
4639         if (!hasShortKeyProperty(currTokType)) {
4640             tokenIdxToClass[tokenShortNameIdx] = currTokType;
4641             currTokType.tokenTypeIdx = tokenShortNameIdx++;
4642         }
4643         // CATEGORIES? : TokenType | TokenType[]
4644         if (hasCategoriesProperty(currTokType) &&
4645             !(0,isArray/* default */.Z)(currTokType.CATEGORIES)
4646         // &&
4647         // !isUndefined(currTokType.CATEGORIES.PATTERN)
4648         ) {
4649             currTokType.CATEGORIES = [currTokType.CATEGORIES];
4650         }
4651         if (!hasCategoriesProperty(currTokType)) {
4652             currTokType.CATEGORIES = [];
4653         }
4654         if (!hasExtendingTokensTypesProperty(currTokType)) {
4655             currTokType.categoryMatches = [];
4656         }
4657         if (!hasExtendingTokensTypesMapProperty(currTokType)) {
4658             currTokType.categoryMatchesMap = {};
4659         }
4660     });
4661 }
4662 function assignCategoriesTokensProp(tokenTypes) {
4663     (0,forEach/* default */.Z)(tokenTypes, (currTokType) => {
4664         // avoid duplications
4665         currTokType.categoryMatches = [];
4666         (0,forEach/* default */.Z)(currTokType.categoryMatchesMap, (val, key) => {
4667             currTokType.categoryMatches.push(tokenIdxToClass[key].tokenTypeIdx);
4668         });
4669     });
4670 }
4671 function assignCategoriesMapProp(tokenTypes) {
4672     (0,forEach/* default */.Z)(tokenTypes, (currTokType) => {
4673         singleAssignCategoriesToksMap([], currTokType);
4674     });
4675 }
4676 function singleAssignCategoriesToksMap(path, nextNode) {
4677     (0,forEach/* default */.Z)(path, (pathNode) => {
4678         nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true;
4679     });
4680     (0,forEach/* default */.Z)(nextNode.CATEGORIES, (nextCategory) => {
4681         const newPath = path.concat(nextNode);
4682         // avoids infinite loops due to cyclic categories.
4683         if (!lodash_es_includes(newPath, nextCategory)) {
4684             singleAssignCategoriesToksMap(newPath, nextCategory);
4685         }
4686     });
4687 }
4688 function hasShortKeyProperty(tokType) {
4689     return (0,has/* default */.Z)(tokType, "tokenTypeIdx");
4690 }
4691 function hasCategoriesProperty(tokType) {
4692     return (0,has/* default */.Z)(tokType, "CATEGORIES");
4693 }
4694 function hasExtendingTokensTypesProperty(tokType) {
4695     return (0,has/* default */.Z)(tokType, "categoryMatches");
4696 }
4697 function hasExtendingTokensTypesMapProperty(tokType) {
4698     return (0,has/* default */.Z)(tokType, "categoryMatchesMap");
4699 }
4700 function isTokenType(tokType) {
4701     return (0,has/* default */.Z)(tokType, "tokenTypeIdx");
4702 }
4703 //# sourceMappingURL=tokens.js.map
4704 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/scan/lexer_errors_public.js
4705 const defaultLexerErrorProvider = {
4706     buildUnableToPopLexerModeMessage(token) {
4707         return `Unable to pop Lexer Mode after encountering Token ->${token.image}<- The Mode Stack is empty`;
4708     },
4709     buildUnexpectedCharactersMessage(fullText, startOffset, length, line, column) {
4710         return (`unexpected character: ->${fullText.charAt(startOffset)}<- at offset: ${startOffset},` + ` skipped ${length} characters.`);
4711     },
4712 };
4713 //# sourceMappingURL=lexer_errors_public.js.map
4714 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/scan/lexer_public.js
4715 
4716 
4717 
4718 
4719 
4720 
4721 var LexerDefinitionErrorType;
4722 (function (LexerDefinitionErrorType) {
4723     LexerDefinitionErrorType[LexerDefinitionErrorType["MISSING_PATTERN"] = 0] = "MISSING_PATTERN";
4724     LexerDefinitionErrorType[LexerDefinitionErrorType["INVALID_PATTERN"] = 1] = "INVALID_PATTERN";
4725     LexerDefinitionErrorType[LexerDefinitionErrorType["EOI_ANCHOR_FOUND"] = 2] = "EOI_ANCHOR_FOUND";
4726     LexerDefinitionErrorType[LexerDefinitionErrorType["UNSUPPORTED_FLAGS_FOUND"] = 3] = "UNSUPPORTED_FLAGS_FOUND";
4727     LexerDefinitionErrorType[LexerDefinitionErrorType["DUPLICATE_PATTERNS_FOUND"] = 4] = "DUPLICATE_PATTERNS_FOUND";
4728     LexerDefinitionErrorType[LexerDefinitionErrorType["INVALID_GROUP_TYPE_FOUND"] = 5] = "INVALID_GROUP_TYPE_FOUND";
4729     LexerDefinitionErrorType[LexerDefinitionErrorType["PUSH_MODE_DOES_NOT_EXIST"] = 6] = "PUSH_MODE_DOES_NOT_EXIST";
4730     LexerDefinitionErrorType[LexerDefinitionErrorType["MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE"] = 7] = "MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE";
4731     LexerDefinitionErrorType[LexerDefinitionErrorType["MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY"] = 8] = "MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY";
4732     LexerDefinitionErrorType[LexerDefinitionErrorType["MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST"] = 9] = "MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST";
4733     LexerDefinitionErrorType[LexerDefinitionErrorType["LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED"] = 10] = "LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED";
4734     LexerDefinitionErrorType[LexerDefinitionErrorType["SOI_ANCHOR_FOUND"] = 11] = "SOI_ANCHOR_FOUND";
4735     LexerDefinitionErrorType[LexerDefinitionErrorType["EMPTY_MATCH_PATTERN"] = 12] = "EMPTY_MATCH_PATTERN";
4736     LexerDefinitionErrorType[LexerDefinitionErrorType["NO_LINE_BREAKS_FLAGS"] = 13] = "NO_LINE_BREAKS_FLAGS";
4737     LexerDefinitionErrorType[LexerDefinitionErrorType["UNREACHABLE_PATTERN"] = 14] = "UNREACHABLE_PATTERN";
4738     LexerDefinitionErrorType[LexerDefinitionErrorType["IDENTIFY_TERMINATOR"] = 15] = "IDENTIFY_TERMINATOR";
4739     LexerDefinitionErrorType[LexerDefinitionErrorType["CUSTOM_LINE_BREAK"] = 16] = "CUSTOM_LINE_BREAK";
4740     LexerDefinitionErrorType[LexerDefinitionErrorType["MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"] = 17] = "MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";
4741 })(LexerDefinitionErrorType || (LexerDefinitionErrorType = {}));
4742 const DEFAULT_LEXER_CONFIG = {
4743     deferDefinitionErrorsHandling: false,
4744     positionTracking: "full",
4745     lineTerminatorsPattern: /\n|\r\n?/g,
4746     lineTerminatorCharacters: ["\n", "\r"],
4747     ensureOptimizations: false,
4748     safeMode: false,
4749     errorMessageProvider: defaultLexerErrorProvider,
4750     traceInitPerf: false,
4751     skipValidations: false,
4752     recoveryEnabled: true,
4753 };
4754 Object.freeze(DEFAULT_LEXER_CONFIG);
4755 class Lexer {
4756     constructor(lexerDefinition, config = DEFAULT_LEXER_CONFIG) {
4757         this.lexerDefinition = lexerDefinition;
4758         this.lexerDefinitionErrors = [];
4759         this.lexerDefinitionWarning = [];
4760         this.patternIdxToConfig = {};
4761         this.charCodeToPatternIdxToConfig = {};
4762         this.modes = [];
4763         this.emptyGroups = {};
4764         this.trackStartLines = true;
4765         this.trackEndLines = true;
4766         this.hasCustom = false;
4767         this.canModeBeOptimized = {};
4768         // Duplicated from the parser's perf trace trait to allow future extraction
4769         // of the lexer to a separate package.
4770         this.TRACE_INIT = (phaseDesc, phaseImpl) => {
4771             // No need to optimize this using NOOP pattern because
4772             // It is not called in a hot spot...
4773             if (this.traceInitPerf === true) {
4774                 this.traceInitIndent++;
4775                 const indent = new Array(this.traceInitIndent + 1).join("\t");
4776                 if (this.traceInitIndent < this.traceInitMaxIdent) {
4777                     console.log(`${indent}--> <${phaseDesc}>`);
4778                 }
4779                 const { time, value } = timer(phaseImpl);
4780                 /* istanbul ignore next - Difficult to reproduce specific performance behavior (>10ms) in tests */
4781                 const traceMethod = time > 10 ? console.warn : console.log;
4782                 if (this.traceInitIndent < this.traceInitMaxIdent) {
4783                     traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`);
4784                 }
4785                 this.traceInitIndent--;
4786                 return value;
4787             }
4788             else {
4789                 return phaseImpl();
4790             }
4791         };
4792         if (typeof config === "boolean") {
4793             throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\n" +
4794                 "a boolean 2nd argument is no longer supported");
4795         }
4796         // todo: defaults func?
4797         this.config = lodash_es_assign({}, DEFAULT_LEXER_CONFIG, config);
4798         const traceInitVal = this.config.traceInitPerf;
4799         if (traceInitVal === true) {
4800             this.traceInitMaxIdent = Infinity;
4801             this.traceInitPerf = true;
4802         }
4803         else if (typeof traceInitVal === "number") {
4804             this.traceInitMaxIdent = traceInitVal;
4805             this.traceInitPerf = true;
4806         }
4807         this.traceInitIndent = -1;
4808         this.TRACE_INIT("Lexer Constructor", () => {
4809             let actualDefinition;
4810             let hasOnlySingleMode = true;
4811             this.TRACE_INIT("Lexer Config handling", () => {
4812                 if (this.config.lineTerminatorsPattern ===
4813                     DEFAULT_LEXER_CONFIG.lineTerminatorsPattern) {
4814                     // optimized built-in implementation for the defaults definition of lineTerminators
4815                     this.config.lineTerminatorsPattern = LineTerminatorOptimizedTester;
4816                 }
4817                 else {
4818                     if (this.config.lineTerminatorCharacters ===
4819                         DEFAULT_LEXER_CONFIG.lineTerminatorCharacters) {
4820                         throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n" +
4821                             "\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");
4822                     }
4823                 }
4824                 if (config.safeMode && config.ensureOptimizations) {
4825                     throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');
4826                 }
4827                 this.trackStartLines = /full|onlyStart/i.test(this.config.positionTracking);
4828                 this.trackEndLines = /full/i.test(this.config.positionTracking);
4829                 // Convert SingleModeLexerDefinition into a IMultiModeLexerDefinition.
4830                 if ((0,isArray/* default */.Z)(lexerDefinition)) {
4831                     actualDefinition = {
4832                         modes: { defaultMode: (0,lodash_es_clone/* default */.Z)(lexerDefinition) },
4833                         defaultMode: DEFAULT_MODE,
4834                     };
4835                 }
4836                 else {
4837                     // no conversion needed, input should already be a IMultiModeLexerDefinition
4838                     hasOnlySingleMode = false;
4839                     actualDefinition = (0,lodash_es_clone/* default */.Z)(lexerDefinition);
4840                 }
4841             });
4842             if (this.config.skipValidations === false) {
4843                 this.TRACE_INIT("performRuntimeChecks", () => {
4844                     this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(performRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters));
4845                 });
4846                 this.TRACE_INIT("performWarningRuntimeChecks", () => {
4847                     this.lexerDefinitionWarning = this.lexerDefinitionWarning.concat(performWarningRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters));
4848                 });
4849             }
4850             // for extra robustness to avoid throwing an none informative error message
4851             actualDefinition.modes = actualDefinition.modes
4852                 ? actualDefinition.modes
4853                 : {};
4854             // an error of undefined TokenTypes will be detected in "performRuntimeChecks" above.
4855             // this transformation is to increase robustness in the case of partially invalid lexer definition.
4856             (0,forEach/* default */.Z)(actualDefinition.modes, (currModeValue, currModeName) => {
4857                 actualDefinition.modes[currModeName] = lodash_es_reject(currModeValue, (currTokType) => (0,isUndefined/* default */.Z)(currTokType));
4858             });
4859             const allModeNames = (0,keys/* default */.Z)(actualDefinition.modes);
4860             (0,forEach/* default */.Z)(actualDefinition.modes, (currModDef, currModName) => {
4861                 this.TRACE_INIT(`Mode: <${currModName}> processing`, () => {
4862                     this.modes.push(currModName);
4863                     if (this.config.skipValidations === false) {
4864                         this.TRACE_INIT(`validatePatterns`, () => {
4865                             this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(validatePatterns(currModDef, allModeNames));
4866                         });
4867                     }
4868                     // If definition errors were encountered, the analysis phase may fail unexpectedly/
4869                     // Considering a lexer with definition errors may never be used, there is no point
4870                     // to performing the analysis anyhow...
4871                     if ((0,isEmpty/* default */.Z)(this.lexerDefinitionErrors)) {
4872                         augmentTokenTypes(currModDef);
4873                         let currAnalyzeResult;
4874                         this.TRACE_INIT(`analyzeTokenTypes`, () => {
4875                             currAnalyzeResult = analyzeTokenTypes(currModDef, {
4876                                 lineTerminatorCharacters: this.config.lineTerminatorCharacters,
4877                                 positionTracking: config.positionTracking,
4878                                 ensureOptimizations: config.ensureOptimizations,
4879                                 safeMode: config.safeMode,
4880                                 tracer: this.TRACE_INIT,
4881                             });
4882                         });
4883                         this.patternIdxToConfig[currModName] =
4884                             currAnalyzeResult.patternIdxToConfig;
4885                         this.charCodeToPatternIdxToConfig[currModName] =
4886                             currAnalyzeResult.charCodeToPatternIdxToConfig;
4887                         this.emptyGroups = lodash_es_assign({}, this.emptyGroups, currAnalyzeResult.emptyGroups);
4888                         this.hasCustom = currAnalyzeResult.hasCustom || this.hasCustom;
4889                         this.canModeBeOptimized[currModName] =
4890                             currAnalyzeResult.canBeOptimized;
4891                     }
4892                 });
4893             });
4894             this.defaultMode = actualDefinition.defaultMode;
4895             if (!(0,isEmpty/* default */.Z)(this.lexerDefinitionErrors) &&
4896                 !this.config.deferDefinitionErrorsHandling) {
4897                 const allErrMessages = (0,map/* default */.Z)(this.lexerDefinitionErrors, (error) => {
4898                     return error.message;
4899                 });
4900                 const allErrMessagesString = allErrMessages.join("-----------------------\n");
4901                 throw new Error("Errors detected in definition of Lexer:\n" + allErrMessagesString);
4902             }
4903             // Only print warning if there are no errors, This will avoid pl
4904             (0,forEach/* default */.Z)(this.lexerDefinitionWarning, (warningDescriptor) => {
4905                 PRINT_WARNING(warningDescriptor.message);
4906             });
4907             this.TRACE_INIT("Choosing sub-methods implementations", () => {
4908                 // Choose the relevant internal implementations for this specific parser.
4909                 // These implementations should be in-lined by the JavaScript engine
4910                 // to provide optimal performance in each scenario.
4911                 if (SUPPORT_STICKY) {
4912                     this.chopInput = identity/* default */.Z;
4913                     this.match = this.matchWithTest;
4914                 }
4915                 else {
4916                     this.updateLastIndex = noop/* default */.Z;
4917                     this.match = this.matchWithExec;
4918                 }
4919                 if (hasOnlySingleMode) {
4920                     this.handleModes = noop/* default */.Z;
4921                 }
4922                 if (this.trackStartLines === false) {
4923                     this.computeNewColumn = identity/* default */.Z;
4924                 }
4925                 if (this.trackEndLines === false) {
4926                     this.updateTokenEndLineColumnLocation = noop/* default */.Z;
4927                 }
4928                 if (/full/i.test(this.config.positionTracking)) {
4929                     this.createTokenInstance = this.createFullToken;
4930                 }
4931                 else if (/onlyStart/i.test(this.config.positionTracking)) {
4932                     this.createTokenInstance = this.createStartOnlyToken;
4933                 }
4934                 else if (/onlyOffset/i.test(this.config.positionTracking)) {
4935                     this.createTokenInstance = this.createOffsetOnlyToken;
4936                 }
4937                 else {
4938                     throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);
4939                 }
4940                 if (this.hasCustom) {
4941                     this.addToken = this.addTokenUsingPush;
4942                     this.handlePayload = this.handlePayloadWithCustom;
4943                 }
4944                 else {
4945                     this.addToken = this.addTokenUsingMemberAccess;
4946                     this.handlePayload = this.handlePayloadNoCustom;
4947                 }
4948             });
4949             this.TRACE_INIT("Failed Optimization Warnings", () => {
4950                 const unOptimizedModes = (0,reduce/* default */.Z)(this.canModeBeOptimized, (cannotBeOptimized, canBeOptimized, modeName) => {
4951                     if (canBeOptimized === false) {
4952                         cannotBeOptimized.push(modeName);
4953                     }
4954                     return cannotBeOptimized;
4955                 }, []);
4956                 if (config.ensureOptimizations && !(0,isEmpty/* default */.Z)(unOptimizedModes)) {
4957                     throw Error(`Lexer Modes: < ${unOptimizedModes.join(", ")} > cannot be optimized.\n` +
4958                         '\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n' +
4959                         "\t Or inspect the console log for details on how to resolve these issues.");
4960                 }
4961             });
4962             this.TRACE_INIT("clearRegExpParserCache", () => {
4963                 clearRegExpParserCache();
4964             });
4965             this.TRACE_INIT("toFastProperties", () => {
4966                 toFastProperties(this);
4967             });
4968         });
4969     }
4970     tokenize(text, initialMode = this.defaultMode) {
4971         if (!(0,isEmpty/* default */.Z)(this.lexerDefinitionErrors)) {
4972             const allErrMessages = (0,map/* default */.Z)(this.lexerDefinitionErrors, (error) => {
4973                 return error.message;
4974             });
4975             const allErrMessagesString = allErrMessages.join("-----------------------\n");
4976             throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n" +
4977                 allErrMessagesString);
4978         }
4979         return this.tokenizeInternal(text, initialMode);
4980     }
4981     // There is quite a bit of duplication between this and "tokenizeInternalLazy"
4982     // This is intentional due to performance considerations.
4983     // this method also used quite a bit of `!` none null assertions because it is too optimized
4984     // for `tsc` to always understand it is "safe"
4985     tokenizeInternal(text, initialMode) {
4986         let i, j, k, matchAltImage, longerAlt, matchedImage, payload, altPayload, imageLength, group, tokType, newToken, errLength, droppedChar, msg, match;
4987         const orgText = text;
4988         const orgLength = orgText.length;
4989         let offset = 0;
4990         let matchedTokensIndex = 0;
4991         // initializing the tokensArray to the "guessed" size.
4992         // guessing too little will still reduce the number of array re-sizes on pushes.
4993         // guessing too large (Tested by guessing x4 too large) may cost a bit more of memory
4994         // but would still have a faster runtime by avoiding (All but one) array resizing.
4995         const guessedNumberOfTokens = this.hasCustom
4996             ? 0 // will break custom token pattern APIs the matchedTokens array will contain undefined elements.
4997             : Math.floor(text.length / 10);
4998         const matchedTokens = new Array(guessedNumberOfTokens);
4999         const errors = [];
5000         let line = this.trackStartLines ? 1 : undefined;
5001         let column = this.trackStartLines ? 1 : undefined;
5002         const groups = cloneEmptyGroups(this.emptyGroups);
5003         const trackLines = this.trackStartLines;
5004         const lineTerminatorPattern = this.config.lineTerminatorsPattern;
5005         let currModePatternsLength = 0;
5006         let patternIdxToConfig = [];
5007         let currCharCodeToPatternIdxToConfig = [];
5008         const modeStack = [];
5009         const emptyArray = [];
5010         Object.freeze(emptyArray);
5011         let getPossiblePatterns;
5012         function getPossiblePatternsSlow() {
5013             return patternIdxToConfig;
5014         }
5015         function getPossiblePatternsOptimized(charCode) {
5016             const optimizedCharIdx = charCodeToOptimizedIndex(charCode);
5017             const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx];
5018             if (possiblePatterns === undefined) {
5019                 return emptyArray;
5020             }
5021             else {
5022                 return possiblePatterns;
5023             }
5024         }
5025         const pop_mode = (popToken) => {
5026             // TODO: perhaps avoid this error in the edge case there is no more input?
5027             if (modeStack.length === 1 &&
5028                 // if we have both a POP_MODE and a PUSH_MODE this is in-fact a "transition"
5029                 // So no error should occur.
5030                 popToken.tokenType.PUSH_MODE === undefined) {
5031                 // if we try to pop the last mode there lexer will no longer have ANY mode.
5032                 // thus the pop is ignored, an error will be created and the lexer will continue parsing in the previous mode.
5033                 const msg = this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(popToken);
5034                 errors.push({
5035                     offset: popToken.startOffset,
5036                     line: popToken.startLine,
5037                     column: popToken.startColumn,
5038                     length: popToken.image.length,
5039                     message: msg,
5040                 });
5041             }
5042             else {
5043                 modeStack.pop();
5044                 const newMode = (0,last/* default */.Z)(modeStack);
5045                 patternIdxToConfig = this.patternIdxToConfig[newMode];
5046                 currCharCodeToPatternIdxToConfig =
5047                     this.charCodeToPatternIdxToConfig[newMode];
5048                 currModePatternsLength = patternIdxToConfig.length;
5049                 const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
5050                 if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
5051                     getPossiblePatterns = getPossiblePatternsOptimized;
5052                 }
5053                 else {
5054                     getPossiblePatterns = getPossiblePatternsSlow;
5055                 }
5056             }
5057         };
5058         function push_mode(newMode) {
5059             modeStack.push(newMode);
5060             currCharCodeToPatternIdxToConfig =
5061                 this.charCodeToPatternIdxToConfig[newMode];
5062             patternIdxToConfig = this.patternIdxToConfig[newMode];
5063             currModePatternsLength = patternIdxToConfig.length;
5064             currModePatternsLength = patternIdxToConfig.length;
5065             const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false;
5066             if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) {
5067                 getPossiblePatterns = getPossiblePatternsOptimized;
5068             }
5069             else {
5070                 getPossiblePatterns = getPossiblePatternsSlow;
5071             }
5072         }
5073         // this pattern seems to avoid a V8 de-optimization, although that de-optimization does not
5074         // seem to matter performance wise.
5075         push_mode.call(this, initialMode);
5076         let currConfig;
5077         const recoveryEnabled = this.config.recoveryEnabled;
5078         while (offset < orgLength) {
5079             matchedImage = null;
5080             const nextCharCode = orgText.charCodeAt(offset);
5081             const chosenPatternIdxToConfig = getPossiblePatterns(nextCharCode);
5082             const chosenPatternsLength = chosenPatternIdxToConfig.length;
5083             for (i = 0; i < chosenPatternsLength; i++) {
5084                 currConfig = chosenPatternIdxToConfig[i];
5085                 const currPattern = currConfig.pattern;
5086                 payload = null;
5087                 // manually in-lined because > 600 chars won't be in-lined in V8
5088                 const singleCharCode = currConfig.short;
5089                 if (singleCharCode !== false) {
5090                     if (nextCharCode === singleCharCode) {
5091                         // single character string
5092                         matchedImage = currPattern;
5093                     }
5094                 }
5095                 else if (currConfig.isCustom === true) {
5096                     match = currPattern.exec(orgText, offset, matchedTokens, groups);
5097                     if (match !== null) {
5098                         matchedImage = match[0];
5099                         if (match.payload !== undefined) {
5100                             payload = match.payload;
5101                         }
5102                     }
5103                     else {
5104                         matchedImage = null;
5105                     }
5106                 }
5107                 else {
5108                     this.updateLastIndex(currPattern, offset);
5109                     matchedImage = this.match(currPattern, text, offset);
5110                 }
5111                 if (matchedImage !== null) {
5112                     // even though this pattern matched we must try a another longer alternative.
5113                     // this can be used to prioritize keywords over identifiers
5114                     longerAlt = currConfig.longerAlt;
5115                     if (longerAlt !== undefined) {
5116                         // TODO: micro optimize, avoid extra prop access
5117                         // by saving/linking longerAlt on the original config?
5118                         const longerAltLength = longerAlt.length;
5119                         for (k = 0; k < longerAltLength; k++) {
5120                             const longerAltConfig = patternIdxToConfig[longerAlt[k]];
5121                             const longerAltPattern = longerAltConfig.pattern;
5122                             altPayload = null;
5123                             // single Char can never be a longer alt so no need to test it.
5124                             // manually in-lined because > 600 chars won't be in-lined in V8
5125                             if (longerAltConfig.isCustom === true) {
5126                                 match = longerAltPattern.exec(orgText, offset, matchedTokens, groups);
5127                                 if (match !== null) {
5128                                     matchAltImage = match[0];
5129                                     if (match.payload !== undefined) {
5130                                         altPayload = match.payload;
5131                                     }
5132                                 }
5133                                 else {
5134                                     matchAltImage = null;
5135                                 }
5136                             }
5137                             else {
5138                                 this.updateLastIndex(longerAltPattern, offset);
5139                                 matchAltImage = this.match(longerAltPattern, text, offset);
5140                             }
5141                             if (matchAltImage && matchAltImage.length > matchedImage.length) {
5142                                 matchedImage = matchAltImage;
5143                                 payload = altPayload;
5144                                 currConfig = longerAltConfig;
5145                                 // Exit the loop early after matching one of the longer alternatives
5146                                 // The first matched alternative takes precedence
5147                                 break;
5148                             }
5149                         }
5150                     }
5151                     break;
5152                 }
5153             }
5154             // successful match
5155             if (matchedImage !== null) {
5156                 imageLength = matchedImage.length;
5157                 group = currConfig.group;
5158                 if (group !== undefined) {
5159                     tokType = currConfig.tokenTypeIdx;
5160                     // TODO: "offset + imageLength" and the new column may be computed twice in case of "full" location information inside
5161                     // createFullToken method
5162                     newToken = this.createTokenInstance(matchedImage, offset, tokType, currConfig.tokenType, line, column, imageLength);
5163                     this.handlePayload(newToken, payload);
5164                     // TODO: optimize NOOP in case there are no special groups?
5165                     if (group === false) {
5166                         matchedTokensIndex = this.addToken(matchedTokens, matchedTokensIndex, newToken);
5167                     }
5168                     else {
5169                         groups[group].push(newToken);
5170                     }
5171                 }
5172                 text = this.chopInput(text, imageLength);
5173                 offset = offset + imageLength;
5174                 // TODO: with newlines the column may be assigned twice
5175                 column = this.computeNewColumn(column, imageLength);
5176                 if (trackLines === true && currConfig.canLineTerminator === true) {
5177                     let numOfLTsInMatch = 0;
5178                     let foundTerminator;
5179                     let lastLTEndOffset;
5180                     lineTerminatorPattern.lastIndex = 0;
5181                     do {
5182                         foundTerminator = lineTerminatorPattern.test(matchedImage);
5183                         if (foundTerminator === true) {
5184                             lastLTEndOffset = lineTerminatorPattern.lastIndex - 1;
5185                             numOfLTsInMatch++;
5186                         }
5187                     } while (foundTerminator === true);
5188                     if (numOfLTsInMatch !== 0) {
5189                         line = line + numOfLTsInMatch;
5190                         column = imageLength - lastLTEndOffset;
5191                         this.updateTokenEndLineColumnLocation(newToken, group, lastLTEndOffset, numOfLTsInMatch, line, column, imageLength);
5192                     }
5193                 }
5194                 // will be NOOP if no modes present
5195                 this.handleModes(currConfig, pop_mode, push_mode, newToken);
5196             }
5197             else {
5198                 // error recovery, drop characters until we identify a valid token's start point
5199                 const errorStartOffset = offset;
5200                 const errorLine = line;
5201                 const errorColumn = column;
5202                 let foundResyncPoint = recoveryEnabled === false;
5203                 while (foundResyncPoint === false && offset < orgLength) {
5204                     // Identity Func (when sticky flag is enabled)
5205                     text = this.chopInput(text, 1);
5206                     offset++;
5207                     for (j = 0; j < currModePatternsLength; j++) {
5208                         const currConfig = patternIdxToConfig[j];
5209                         const currPattern = currConfig.pattern;
5210                         // manually in-lined because > 600 chars won't be in-lined in V8
5211                         const singleCharCode = currConfig.short;
5212                         if (singleCharCode !== false) {
5213                             if (orgText.charCodeAt(offset) === singleCharCode) {
5214                                 // single character string
5215                                 foundResyncPoint = true;
5216                             }
5217                         }
5218                         else if (currConfig.isCustom === true) {
5219                             foundResyncPoint =
5220                                 currPattern.exec(orgText, offset, matchedTokens, groups) !== null;
5221                         }
5222                         else {
5223                             this.updateLastIndex(currPattern, offset);
5224                             foundResyncPoint = currPattern.exec(text) !== null;
5225                         }
5226                         if (foundResyncPoint === true) {
5227                             break;
5228                         }
5229                     }
5230                 }
5231                 errLength = offset - errorStartOffset;
5232                 column = this.computeNewColumn(column, errLength);
5233                 // at this point we either re-synced or reached the end of the input text
5234                 msg = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(orgText, errorStartOffset, errLength, errorLine, errorColumn);
5235                 errors.push({
5236                     offset: errorStartOffset,
5237                     line: errorLine,
5238                     column: errorColumn,
5239                     length: errLength,
5240                     message: msg,
5241                 });
5242                 if (recoveryEnabled === false) {
5243                     break;
5244                 }
5245             }
5246         }
5247         // if we do have custom patterns which push directly into the
5248         // TODO: custom tokens should not push directly??
5249         if (!this.hasCustom) {
5250             // if we guessed a too large size for the tokens array this will shrink it to the right size.
5251             matchedTokens.length = matchedTokensIndex;
5252         }
5253         return {
5254             tokens: matchedTokens,
5255             groups: groups,
5256             errors: errors,
5257         };
5258     }
5259     handleModes(config, pop_mode, push_mode, newToken) {
5260         if (config.pop === true) {
5261             // need to save the PUSH_MODE property as if the mode is popped
5262             // patternIdxToPopMode is updated to reflect the new mode after popping the stack
5263             const pushMode = config.push;
5264             pop_mode(newToken);
5265             if (pushMode !== undefined) {
5266                 push_mode.call(this, pushMode);
5267             }
5268         }
5269         else if (config.push !== undefined) {
5270             push_mode.call(this, config.push);
5271         }
5272     }
5273     chopInput(text, length) {
5274         return text.substring(length);
5275     }
5276     updateLastIndex(regExp, newLastIndex) {
5277         regExp.lastIndex = newLastIndex;
5278     }
5279     // TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler
5280     updateTokenEndLineColumnLocation(newToken, group, lastLTIdx, numOfLTsInMatch, line, column, imageLength) {
5281         let lastCharIsLT, fixForEndingInLT;
5282         if (group !== undefined) {
5283             // a none skipped multi line Token, need to update endLine/endColumn
5284             lastCharIsLT = lastLTIdx === imageLength - 1;
5285             fixForEndingInLT = lastCharIsLT ? -1 : 0;
5286             if (!(numOfLTsInMatch === 1 && lastCharIsLT === true)) {
5287                 // if a token ends in a LT that last LT only affects the line numbering of following Tokens
5288                 newToken.endLine = line + fixForEndingInLT;
5289                 // the last LT in a token does not affect the endColumn either as the [columnStart ... columnEnd)
5290                 // inclusive to exclusive range.
5291                 newToken.endColumn = column - 1 + -fixForEndingInLT;
5292             }
5293             // else single LT in the last character of a token, no need to modify the endLine/EndColumn
5294         }
5295     }
5296     computeNewColumn(oldColumn, imageLength) {
5297         return oldColumn + imageLength;
5298     }
5299     createOffsetOnlyToken(image, startOffset, tokenTypeIdx, tokenType) {
5300         return {
5301             image,
5302             startOffset,
5303             tokenTypeIdx,
5304             tokenType,
5305         };
5306     }
5307     createStartOnlyToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn) {
5308         return {
5309             image,
5310             startOffset,
5311             startLine,
5312             startColumn,
5313             tokenTypeIdx,
5314             tokenType,
5315         };
5316     }
5317     createFullToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn, imageLength) {
5318         return {
5319             image,
5320             startOffset,
5321             endOffset: startOffset + imageLength - 1,
5322             startLine,
5323             endLine: startLine,
5324             startColumn,
5325             endColumn: startColumn + imageLength - 1,
5326             tokenTypeIdx,
5327             tokenType,
5328         };
5329     }
5330     addTokenUsingPush(tokenVector, index, tokenToAdd) {
5331         tokenVector.push(tokenToAdd);
5332         return index;
5333     }
5334     addTokenUsingMemberAccess(tokenVector, index, tokenToAdd) {
5335         tokenVector[index] = tokenToAdd;
5336         index++;
5337         return index;
5338     }
5339     handlePayloadNoCustom(token, payload) { }
5340     handlePayloadWithCustom(token, payload) {
5341         if (payload !== null) {
5342             token.payload = payload;
5343         }
5344     }
5345     matchWithTest(pattern, text, offset) {
5346         const found = pattern.test(text);
5347         if (found === true) {
5348             return text.substring(offset, pattern.lastIndex);
5349         }
5350         return null;
5351     }
5352     matchWithExec(pattern, text) {
5353         const regExpArray = pattern.exec(text);
5354         return regExpArray !== null ? regExpArray[0] : null;
5355     }
5356 }
5357 Lexer.SKIPPED = "This marks a skipped Token pattern, this means each token identified by it will" +
5358     "be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";
5359 Lexer.NA = /NOT_APPLICABLE/;
5360 //# sourceMappingURL=lexer_public.js.map
5361 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/scan/tokens_public.js
5362 
5363 
5364 
5365 function tokens_public_tokenLabel(tokType) {
5366     if (tokens_public_hasTokenLabel(tokType)) {
5367         return tokType.LABEL;
5368     }
5369     else {
5370         return tokType.name;
5371     }
5372 }
5373 function tokenName(tokType) {
5374     return tokType.name;
5375 }
5376 function tokens_public_hasTokenLabel(obj) {
5377     return (0,isString/* default */.Z)(obj.LABEL) && obj.LABEL !== "";
5378 }
5379 const PARENT = "parent";
5380 const CATEGORIES = "categories";
5381 const LABEL = "label";
5382 const GROUP = "group";
5383 const PUSH_MODE = "push_mode";
5384 const POP_MODE = "pop_mode";
5385 const LONGER_ALT = "longer_alt";
5386 const LINE_BREAKS = "line_breaks";
5387 const START_CHARS_HINT = "start_chars_hint";
5388 function createToken(config) {
5389     return createTokenInternal(config);
5390 }
5391 function createTokenInternal(config) {
5392     const pattern = config.pattern;
5393     const tokenType = {};
5394     tokenType.name = config.name;
5395     if (!(0,isUndefined/* default */.Z)(pattern)) {
5396         tokenType.PATTERN = pattern;
5397     }
5398     if ((0,has/* default */.Z)(config, PARENT)) {
5399         throw ("The parent property is no longer supported.\n" +
5400             "See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.");
5401     }
5402     if ((0,has/* default */.Z)(config, CATEGORIES)) {
5403         // casting to ANY as this will be fixed inside `augmentTokenTypes``
5404         tokenType.CATEGORIES = config[CATEGORIES];
5405     }
5406     augmentTokenTypes([tokenType]);
5407     if ((0,has/* default */.Z)(config, LABEL)) {
5408         tokenType.LABEL = config[LABEL];
5409     }
5410     if ((0,has/* default */.Z)(config, GROUP)) {
5411         tokenType.GROUP = config[GROUP];
5412     }
5413     if ((0,has/* default */.Z)(config, POP_MODE)) {
5414         tokenType.POP_MODE = config[POP_MODE];
5415     }
5416     if ((0,has/* default */.Z)(config, PUSH_MODE)) {
5417         tokenType.PUSH_MODE = config[PUSH_MODE];
5418     }
5419     if ((0,has/* default */.Z)(config, LONGER_ALT)) {
5420         tokenType.LONGER_ALT = config[LONGER_ALT];
5421     }
5422     if ((0,has/* default */.Z)(config, LINE_BREAKS)) {
5423         tokenType.LINE_BREAKS = config[LINE_BREAKS];
5424     }
5425     if ((0,has/* default */.Z)(config, START_CHARS_HINT)) {
5426         tokenType.START_CHARS_HINT = config[START_CHARS_HINT];
5427     }
5428     return tokenType;
5429 }
5430 const EOF = createToken({ name: "EOF", pattern: Lexer.NA });
5431 augmentTokenTypes([EOF]);
5432 function createTokenInstance(tokType, image, startOffset, endOffset, startLine, endLine, startColumn, endColumn) {
5433     return {
5434         image,
5435         startOffset,
5436         endOffset,
5437         startLine,
5438         endLine,
5439         startColumn,
5440         endColumn,
5441         tokenTypeIdx: tokType.tokenTypeIdx,
5442         tokenType: tokType,
5443     };
5444 }
5445 function tokenMatcher(token, tokType) {
5446     return tokenStructuredMatcher(token, tokType);
5447 }
5448 //# sourceMappingURL=tokens_public.js.map
5449 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/errors_public.js
5450 
5451 
5452 
5453 const defaultParserErrorProvider = {
5454     buildMismatchTokenMessage({ expected, actual, previous, ruleName }) {
5455         const hasLabel = tokens_public_hasTokenLabel(expected);
5456         const expectedMsg = hasLabel
5457             ? `--> ${tokens_public_tokenLabel(expected)} <--`
5458             : `token of type --> ${expected.name} <--`;
5459         const msg = `Expecting ${expectedMsg} but found --> '${actual.image}' <--`;
5460         return msg;
5461     },
5462     buildNotAllInputParsedMessage({ firstRedundant, ruleName }) {
5463         return "Redundant input, expecting EOF but found: " + firstRedundant.image;
5464     },
5465     buildNoViableAltMessage({ expectedPathsPerAlt, actual, previous, customUserDescription, ruleName, }) {
5466         const errPrefix = "Expecting: ";
5467         // TODO: issue: No Viable Alternative Error may have incomplete details. #502
5468         const actualText = lodash_es_head(actual).image;
5469         const errSuffix = "\nbut found: '" + actualText + "'";
5470         if (customUserDescription) {
5471             return errPrefix + customUserDescription + errSuffix;
5472         }
5473         else {
5474             const allLookAheadPaths = (0,reduce/* default */.Z)(expectedPathsPerAlt, (result, currAltPaths) => result.concat(currAltPaths), []);
5475             const nextValidTokenSequences = (0,map/* default */.Z)(allLookAheadPaths, (currPath) => `[${(0,map/* default */.Z)(currPath, (currTokenType) => tokens_public_tokenLabel(currTokenType)).join(", ")}]`);
5476             const nextValidSequenceItems = (0,map/* default */.Z)(nextValidTokenSequences, (itemMsg, idx) => `  ${idx + 1}. ${itemMsg}`);
5477             const calculatedDescription = `one of these possible Token sequences:\n${nextValidSequenceItems.join("\n")}`;
5478             return errPrefix + calculatedDescription + errSuffix;
5479         }
5480     },
5481     buildEarlyExitMessage({ expectedIterationPaths, actual, customUserDescription, ruleName, }) {
5482         const errPrefix = "Expecting: ";
5483         // TODO: issue: No Viable Alternative Error may have incomplete details. #502
5484         const actualText = lodash_es_head(actual).image;
5485         const errSuffix = "\nbut found: '" + actualText + "'";
5486         if (customUserDescription) {
5487             return errPrefix + customUserDescription + errSuffix;
5488         }
5489         else {
5490             const nextValidTokenSequences = (0,map/* default */.Z)(expectedIterationPaths, (currPath) => `[${(0,map/* default */.Z)(currPath, (currTokenType) => tokens_public_tokenLabel(currTokenType)).join(",")}]`);
5491             const calculatedDescription = `expecting at least one iteration which starts with one of these possible Token sequences::\n  ` +
5492                 `<${nextValidTokenSequences.join(" ,")}>`;
5493             return errPrefix + calculatedDescription + errSuffix;
5494         }
5495     },
5496 };
5497 Object.freeze(defaultParserErrorProvider);
5498 const defaultGrammarResolverErrorProvider = {
5499     buildRuleNotFoundError(topLevelRule, undefinedRule) {
5500         const msg = "Invalid grammar, reference to a rule which is not defined: ->" +
5501             undefinedRule.nonTerminalName +
5502             "<-\n" +
5503             "inside top level rule: ->" +
5504             topLevelRule.name +
5505             "<-";
5506         return msg;
5507     },
5508 };
5509 const defaultGrammarValidatorErrorProvider = {
5510     buildDuplicateFoundError(topLevelRule, duplicateProds) {
5511         function getExtraProductionArgument(prod) {
5512             if (prod instanceof Terminal) {
5513                 return prod.terminalType.name;
5514             }
5515             else if (prod instanceof NonTerminal) {
5516                 return prod.nonTerminalName;
5517             }
5518             else {
5519                 return "";
5520             }
5521         }
5522         const topLevelName = topLevelRule.name;
5523         const duplicateProd = lodash_es_head(duplicateProds);
5524         const index = duplicateProd.idx;
5525         const dslName = getProductionDslName(duplicateProd);
5526         const extraArgument = getExtraProductionArgument(duplicateProd);
5527         const hasExplicitIndex = index > 0;
5528         let msg = `->${dslName}${hasExplicitIndex ? index : ""}<- ${extraArgument ? `with argument: ->${extraArgument}<-` : ""}
5529                   appears more than once (${duplicateProds.length} times) in the top level rule: ->${topLevelName}<-.                   
5530                   For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES  
5531                   `;
5532         // white space trimming time! better to trim afterwards as it allows to use WELL formatted multi line template strings...
5533         msg = msg.replace(/[ \t]+/g, " ");
5534         msg = msg.replace(/\s\s+/g, "\n");
5535         return msg;
5536     },
5537     buildNamespaceConflictError(rule) {
5538         const errMsg = `Namespace conflict found in grammar.\n` +
5539             `The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${rule.name}>.\n` +
5540             `To resolve this make sure each Terminal and Non-Terminal names are unique\n` +
5541             `This is easy to accomplish by using the convention that Terminal names start with an uppercase letter\n` +
5542             `and Non-Terminal names start with a lower case letter.`;
5543         return errMsg;
5544     },
5545     buildAlternationPrefixAmbiguityError(options) {
5546         const pathMsg = (0,map/* default */.Z)(options.prefixPath, (currTok) => tokens_public_tokenLabel(currTok)).join(", ");
5547         const occurrence = options.alternation.idx === 0 ? "" : options.alternation.idx;
5548         const errMsg = `Ambiguous alternatives: <${options.ambiguityIndices.join(" ,")}> due to common lookahead prefix\n` +
5549             `in <OR${occurrence}> inside <${options.topLevelRule.name}> Rule,\n` +
5550             `<${pathMsg}> may appears as a prefix path in all these alternatives.\n` +
5551             `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\n` +
5552             `For Further details.`;
5553         return errMsg;
5554     },
5555     buildAlternationAmbiguityError(options) {
5556         const pathMsg = (0,map/* default */.Z)(options.prefixPath, (currtok) => tokens_public_tokenLabel(currtok)).join(", ");
5557         const occurrence = options.alternation.idx === 0 ? "" : options.alternation.idx;
5558         let currMessage = `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(" ,")}> in <OR${occurrence}>` +
5559             ` inside <${options.topLevelRule.name}> Rule,\n` +
5560             `<${pathMsg}> may appears as a prefix path in all these alternatives.\n`;
5561         currMessage =
5562             currMessage +
5563                 `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\n` +
5564                 `For Further details.`;
5565         return currMessage;
5566     },
5567     buildEmptyRepetitionError(options) {
5568         let dslName = getProductionDslName(options.repetition);
5569         if (options.repetition.idx !== 0) {
5570             dslName += options.repetition.idx;
5571         }
5572         const errMsg = `The repetition <${dslName}> within Rule <${options.topLevelRule.name}> can never consume any tokens.\n` +
5573             `This could lead to an infinite loop.`;
5574         return errMsg;
5575     },
5576     // TODO: remove - `errors_public` from nyc.config.js exclude
5577     //       once this method is fully removed from this file
5578     buildTokenNameError(options) {
5579         /* istanbul ignore next */
5580         return "deprecated";
5581     },
5582     buildEmptyAlternationError(options) {
5583         const errMsg = `Ambiguous empty alternative: <${options.emptyChoiceIdx + 1}>` +
5584             ` in <OR${options.alternation.idx}> inside <${options.topLevelRule.name}> Rule.\n` +
5585             `Only the last alternative may be an empty alternative.`;
5586         return errMsg;
5587     },
5588     buildTooManyAlternativesError(options) {
5589         const errMsg = `An Alternation cannot have more than 256 alternatives:\n` +
5590             `<OR${options.alternation.idx}> inside <${options.topLevelRule.name}> Rule.\n has ${options.alternation.definition.length + 1} alternatives.`;
5591         return errMsg;
5592     },
5593     buildLeftRecursionError(options) {
5594         const ruleName = options.topLevelRule.name;
5595         const pathNames = (0,map/* default */.Z)(options.leftRecursionPath, (currRule) => currRule.name);
5596         const leftRecursivePath = `${ruleName} --> ${pathNames
5597             .concat([ruleName])
5598             .join(" --> ")}`;
5599         const errMsg = `Left Recursion found in grammar.\n` +
5600             `rule: <${ruleName}> can be invoked from itself (directly or indirectly)\n` +
5601             `without consuming any Tokens. The grammar path that causes this is: \n ${leftRecursivePath}\n` +
5602             ` To fix this refactor your grammar to remove the left recursion.\n` +
5603             `see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`;
5604         return errMsg;
5605     },
5606     // TODO: remove - `errors_public` from nyc.config.js exclude
5607     //       once this method is fully removed from this file
5608     buildInvalidRuleNameError(options) {
5609         /* istanbul ignore next */
5610         return "deprecated";
5611     },
5612     buildDuplicateRuleNameError(options) {
5613         let ruleName;
5614         if (options.topLevelRule instanceof Rule) {
5615             ruleName = options.topLevelRule.name;
5616         }
5617         else {
5618             ruleName = options.topLevelRule;
5619         }
5620         const errMsg = `Duplicate definition, rule: ->${ruleName}<- is already defined in the grammar: ->${options.grammarName}<-`;
5621         return errMsg;
5622     },
5623 };
5624 //# sourceMappingURL=errors_public.js.map
5625 ;// CONCATENATED MODULE: ../node_modules/@chevrotain/gast/lib/src/visitor.js
5626 
5627 class GAstVisitor {
5628     visit(node) {
5629         const nodeAny = node;
5630         switch (nodeAny.constructor) {
5631             case NonTerminal:
5632                 return this.visitNonTerminal(nodeAny);
5633             case Alternative:
5634                 return this.visitAlternative(nodeAny);
5635             case Option:
5636                 return this.visitOption(nodeAny);
5637             case RepetitionMandatory:
5638                 return this.visitRepetitionMandatory(nodeAny);
5639             case RepetitionMandatoryWithSeparator:
5640                 return this.visitRepetitionMandatoryWithSeparator(nodeAny);
5641             case RepetitionWithSeparator:
5642                 return this.visitRepetitionWithSeparator(nodeAny);
5643             case Repetition:
5644                 return this.visitRepetition(nodeAny);
5645             case Alternation:
5646                 return this.visitAlternation(nodeAny);
5647             case Terminal:
5648                 return this.visitTerminal(nodeAny);
5649             case Rule:
5650                 return this.visitRule(nodeAny);
5651             /* c8 ignore next 2 */
5652             default:
5653                 throw Error("non exhaustive match");
5654         }
5655     }
5656     /* c8 ignore next */
5657     visitNonTerminal(node) { }
5658     /* c8 ignore next */
5659     visitAlternative(node) { }
5660     /* c8 ignore next */
5661     visitOption(node) { }
5662     /* c8 ignore next */
5663     visitRepetition(node) { }
5664     /* c8 ignore next */
5665     visitRepetitionMandatory(node) { }
5666     /* c8 ignore next 3 */
5667     visitRepetitionMandatoryWithSeparator(node) { }
5668     /* c8 ignore next */
5669     visitRepetitionWithSeparator(node) { }
5670     /* c8 ignore next */
5671     visitAlternation(node) { }
5672     /* c8 ignore next */
5673     visitTerminal(node) { }
5674     /* c8 ignore next */
5675     visitRule(node) { }
5676 }
5677 //# sourceMappingURL=visitor.js.map
5678 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/grammar/resolver.js
5679 
5680 
5681 
5682 function resolveGrammar(topLevels, errMsgProvider) {
5683     const refResolver = new GastRefResolverVisitor(topLevels, errMsgProvider);
5684     refResolver.resolveRefs();
5685     return refResolver.errors;
5686 }
5687 class GastRefResolverVisitor extends GAstVisitor {
5688     constructor(nameToTopRule, errMsgProvider) {
5689         super();
5690         this.nameToTopRule = nameToTopRule;
5691         this.errMsgProvider = errMsgProvider;
5692         this.errors = [];
5693     }
5694     resolveRefs() {
5695         (0,forEach/* default */.Z)((0,values/* default */.Z)(this.nameToTopRule), (prod) => {
5696             this.currTopLevel = prod;
5697             prod.accept(this);
5698         });
5699     }
5700     visitNonTerminal(node) {
5701         const ref = this.nameToTopRule[node.nonTerminalName];
5702         if (!ref) {
5703             const msg = this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel, node);
5704             this.errors.push({
5705                 message: msg,
5706                 type: ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,
5707                 ruleName: this.currTopLevel.name,
5708                 unresolvedRefName: node.nonTerminalName,
5709             });
5710         }
5711         else {
5712             node.referencedRule = ref;
5713         }
5714     }
5715 }
5716 //# sourceMappingURL=resolver.js.map
5717 // EXTERNAL MODULE: ../node_modules/lodash-es/flatMap.js
5718 var flatMap = __webpack_require__(34134);
5719 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseAssignValue.js
5720 var _baseAssignValue = __webpack_require__(93586);
5721 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_arrayAggregator.js
5722 /**
5723  * A specialized version of `baseAggregator` for arrays.
5724  *
5725  * @private
5726  * @param {Array} [array] The array to iterate over.
5727  * @param {Function} setter The function to set `accumulator` values.
5728  * @param {Function} iteratee The iteratee to transform keys.
5729  * @param {Object} accumulator The initial aggregated object.
5730  * @returns {Function} Returns `accumulator`.
5731  */
5732 function arrayAggregator(array, setter, iteratee, accumulator) {
5733   var index = -1,
5734       length = array == null ? 0 : array.length;
5735 
5736   while (++index < length) {
5737     var value = array[index];
5738     setter(accumulator, value, iteratee(value), array);
5739   }
5740   return accumulator;
5741 }
5742 
5743 /* harmony default export */ const _arrayAggregator = (arrayAggregator);
5744 
5745 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseAggregator.js
5746 
5747 
5748 /**
5749  * Aggregates elements of `collection` on `accumulator` with keys transformed
5750  * by `iteratee` and values set by `setter`.
5751  *
5752  * @private
5753  * @param {Array|Object} collection The collection to iterate over.
5754  * @param {Function} setter The function to set `accumulator` values.
5755  * @param {Function} iteratee The iteratee to transform keys.
5756  * @param {Object} accumulator The initial aggregated object.
5757  * @returns {Function} Returns `accumulator`.
5758  */
5759 function baseAggregator(collection, setter, iteratee, accumulator) {
5760   (0,_baseEach/* default */.Z)(collection, function(value, key, collection) {
5761     setter(accumulator, value, iteratee(value), collection);
5762   });
5763   return accumulator;
5764 }
5765 
5766 /* harmony default export */ const _baseAggregator = (baseAggregator);
5767 
5768 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_createAggregator.js
5769 
5770 
5771 
5772 
5773 
5774 /**
5775  * Creates a function like `_.groupBy`.
5776  *
5777  * @private
5778  * @param {Function} setter The function to set accumulator values.
5779  * @param {Function} [initializer] The accumulator object initializer.
5780  * @returns {Function} Returns the new aggregator function.
5781  */
5782 function createAggregator(setter, initializer) {
5783   return function(collection, iteratee) {
5784     var func = (0,isArray/* default */.Z)(collection) ? _arrayAggregator : _baseAggregator,
5785         accumulator = initializer ? initializer() : {};
5786 
5787     return func(collection, setter, (0,_baseIteratee/* default */.Z)(iteratee, 2), accumulator);
5788   };
5789 }
5790 
5791 /* harmony default export */ const _createAggregator = (createAggregator);
5792 
5793 ;// CONCATENATED MODULE: ../node_modules/lodash-es/groupBy.js
5794 
5795 
5796 
5797 /** Used for built-in method references. */
5798 var groupBy_objectProto = Object.prototype;
5799 
5800 /** Used to check objects for own properties. */
5801 var groupBy_hasOwnProperty = groupBy_objectProto.hasOwnProperty;
5802 
5803 /**
5804  * Creates an object composed of keys generated from the results of running
5805  * each element of `collection` thru `iteratee`. The order of grouped values
5806  * is determined by the order they occur in `collection`. The corresponding
5807  * value of each key is an array of elements responsible for generating the
5808  * key. The iteratee is invoked with one argument: (value).
5809  *
5810  * @static
5811  * @memberOf _
5812  * @since 0.1.0
5813  * @category Collection
5814  * @param {Array|Object} collection The collection to iterate over.
5815  * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
5816  * @returns {Object} Returns the composed aggregate object.
5817  * @example
5818  *
5819  * _.groupBy([6.1, 4.2, 6.3], Math.floor);
5820  * // => { '4': [4.2], '6': [6.1, 6.3] }
5821  *
5822  * // The `_.property` iteratee shorthand.
5823  * _.groupBy(['one', 'two', 'three'], 'length');
5824  * // => { '3': ['one', 'two'], '5': ['three'] }
5825  */
5826 var groupBy = _createAggregator(function(result, value, key) {
5827   if (groupBy_hasOwnProperty.call(result, key)) {
5828     result[key].push(value);
5829   } else {
5830     (0,_baseAssignValue/* default */.Z)(result, key, [value]);
5831   }
5832 });
5833 
5834 /* harmony default export */ const lodash_es_groupBy = (groupBy);
5835 
5836 ;// CONCATENATED MODULE: ../node_modules/lodash-es/dropRight.js
5837 
5838 
5839 
5840 /**
5841  * Creates a slice of `array` with `n` elements dropped from the end.
5842  *
5843  * @static
5844  * @memberOf _
5845  * @since 3.0.0
5846  * @category Array
5847  * @param {Array} array The array to query.
5848  * @param {number} [n=1] The number of elements to drop.
5849  * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
5850  * @returns {Array} Returns the slice of `array`.
5851  * @example
5852  *
5853  * _.dropRight([1, 2, 3]);
5854  * // => [1, 2]
5855  *
5856  * _.dropRight([1, 2, 3], 2);
5857  * // => [1]
5858  *
5859  * _.dropRight([1, 2, 3], 5);
5860  * // => []
5861  *
5862  * _.dropRight([1, 2, 3], 0);
5863  * // => [1, 2, 3]
5864  */
5865 function dropRight(array, n, guard) {
5866   var length = array == null ? 0 : array.length;
5867   if (!length) {
5868     return [];
5869   }
5870   n = (guard || n === undefined) ? 1 : (0,toInteger/* default */.Z)(n);
5871   n = length - n;
5872   return _baseSlice(array, 0, n < 0 ? 0 : n);
5873 }
5874 
5875 /* harmony default export */ const lodash_es_dropRight = (dropRight);
5876 
5877 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/grammar/interpreter.js
5878 
5879 
5880 
5881 
5882 class AbstractNextPossibleTokensWalker extends RestWalker {
5883     constructor(topProd, path) {
5884         super();
5885         this.topProd = topProd;
5886         this.path = path;
5887         this.possibleTokTypes = [];
5888         this.nextProductionName = "";
5889         this.nextProductionOccurrence = 0;
5890         this.found = false;
5891         this.isAtEndOfPath = false;
5892     }
5893     startWalking() {
5894         this.found = false;
5895         if (this.path.ruleStack[0] !== this.topProd.name) {
5896             throw Error("The path does not start with the walker's top Rule!");
5897         }
5898         // immutable for the win
5899         this.ruleStack = (0,lodash_es_clone/* default */.Z)(this.path.ruleStack).reverse(); // intelij bug requires assertion
5900         this.occurrenceStack = (0,lodash_es_clone/* default */.Z)(this.path.occurrenceStack).reverse(); // intelij bug requires assertion
5901         // already verified that the first production is valid, we now seek the 2nd production
5902         this.ruleStack.pop();
5903         this.occurrenceStack.pop();
5904         this.updateExpectedNext();
5905         this.walk(this.topProd);
5906         return this.possibleTokTypes;
5907     }
5908     walk(prod, prevRest = []) {
5909         // stop scanning once we found the path
5910         if (!this.found) {
5911             super.walk(prod, prevRest);
5912         }
5913     }
5914     walkProdRef(refProd, currRest, prevRest) {
5915         // found the next production, need to keep walking in it
5916         if (refProd.referencedRule.name === this.nextProductionName &&
5917             refProd.idx === this.nextProductionOccurrence) {
5918             const fullRest = currRest.concat(prevRest);
5919             this.updateExpectedNext();
5920             this.walk(refProd.referencedRule, fullRest);
5921         }
5922     }
5923     updateExpectedNext() {
5924         // need to consume the Terminal
5925         if ((0,isEmpty/* default */.Z)(this.ruleStack)) {
5926             // must reset nextProductionXXX to avoid walking down another Top Level production while what we are
5927             // really seeking is the last Terminal...
5928             this.nextProductionName = "";
5929             this.nextProductionOccurrence = 0;
5930             this.isAtEndOfPath = true;
5931         }
5932         else {
5933             this.nextProductionName = this.ruleStack.pop();
5934             this.nextProductionOccurrence = this.occurrenceStack.pop();
5935         }
5936     }
5937 }
5938 class NextAfterTokenWalker extends AbstractNextPossibleTokensWalker {
5939     constructor(topProd, path) {
5940         super(topProd, path);
5941         this.path = path;
5942         this.nextTerminalName = "";
5943         this.nextTerminalOccurrence = 0;
5944         this.nextTerminalName = this.path.lastTok.name;
5945         this.nextTerminalOccurrence = this.path.lastTokOccurrence;
5946     }
5947     walkTerminal(terminal, currRest, prevRest) {
5948         if (this.isAtEndOfPath &&
5949             terminal.terminalType.name === this.nextTerminalName &&
5950             terminal.idx === this.nextTerminalOccurrence &&
5951             !this.found) {
5952             const fullRest = currRest.concat(prevRest);
5953             const restProd = new Alternative({ definition: fullRest });
5954             this.possibleTokTypes = first(restProd);
5955             this.found = true;
5956         }
5957     }
5958 }
5959 /**
5960  * This walker only "walks" a single "TOP" level in the Grammar Ast, this means
5961  * it never "follows" production refs
5962  */
5963 class AbstractNextTerminalAfterProductionWalker extends RestWalker {
5964     constructor(topRule, occurrence) {
5965         super();
5966         this.topRule = topRule;
5967         this.occurrence = occurrence;
5968         this.result = {
5969             token: undefined,
5970             occurrence: undefined,
5971             isEndOfRule: undefined,
5972         };
5973     }
5974     startWalking() {
5975         this.walk(this.topRule);
5976         return this.result;
5977     }
5978 }
5979 class NextTerminalAfterManyWalker extends AbstractNextTerminalAfterProductionWalker {
5980     walkMany(manyProd, currRest, prevRest) {
5981         if (manyProd.idx === this.occurrence) {
5982             const firstAfterMany = lodash_es_head(currRest.concat(prevRest));
5983             this.result.isEndOfRule = firstAfterMany === undefined;
5984             if (firstAfterMany instanceof Terminal) {
5985                 this.result.token = firstAfterMany.terminalType;
5986                 this.result.occurrence = firstAfterMany.idx;
5987             }
5988         }
5989         else {
5990             super.walkMany(manyProd, currRest, prevRest);
5991         }
5992     }
5993 }
5994 class NextTerminalAfterManySepWalker extends AbstractNextTerminalAfterProductionWalker {
5995     walkManySep(manySepProd, currRest, prevRest) {
5996         if (manySepProd.idx === this.occurrence) {
5997             const firstAfterManySep = lodash_es_head(currRest.concat(prevRest));
5998             this.result.isEndOfRule = firstAfterManySep === undefined;
5999             if (firstAfterManySep instanceof Terminal) {
6000                 this.result.token = firstAfterManySep.terminalType;
6001                 this.result.occurrence = firstAfterManySep.idx;
6002             }
6003         }
6004         else {
6005             super.walkManySep(manySepProd, currRest, prevRest);
6006         }
6007     }
6008 }
6009 class NextTerminalAfterAtLeastOneWalker extends AbstractNextTerminalAfterProductionWalker {
6010     walkAtLeastOne(atLeastOneProd, currRest, prevRest) {
6011         if (atLeastOneProd.idx === this.occurrence) {
6012             const firstAfterAtLeastOne = lodash_es_head(currRest.concat(prevRest));
6013             this.result.isEndOfRule = firstAfterAtLeastOne === undefined;
6014             if (firstAfterAtLeastOne instanceof Terminal) {
6015                 this.result.token = firstAfterAtLeastOne.terminalType;
6016                 this.result.occurrence = firstAfterAtLeastOne.idx;
6017             }
6018         }
6019         else {
6020             super.walkAtLeastOne(atLeastOneProd, currRest, prevRest);
6021         }
6022     }
6023 }
6024 // TODO: reduce code duplication in the AfterWalkers
6025 class NextTerminalAfterAtLeastOneSepWalker extends AbstractNextTerminalAfterProductionWalker {
6026     walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest) {
6027         if (atleastOneSepProd.idx === this.occurrence) {
6028             const firstAfterfirstAfterAtLeastOneSep = lodash_es_head(currRest.concat(prevRest));
6029             this.result.isEndOfRule = firstAfterfirstAfterAtLeastOneSep === undefined;
6030             if (firstAfterfirstAfterAtLeastOneSep instanceof Terminal) {
6031                 this.result.token = firstAfterfirstAfterAtLeastOneSep.terminalType;
6032                 this.result.occurrence = firstAfterfirstAfterAtLeastOneSep.idx;
6033             }
6034         }
6035         else {
6036             super.walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest);
6037         }
6038     }
6039 }
6040 function possiblePathsFrom(targetDef, maxLength, currPath = []) {
6041     // avoid side effects
6042     currPath = (0,lodash_es_clone/* default */.Z)(currPath);
6043     let result = [];
6044     let i = 0;
6045     // TODO: avoid inner funcs
6046     function remainingPathWith(nextDef) {
6047         return nextDef.concat(lodash_es_drop(targetDef, i + 1));
6048     }
6049     // TODO: avoid inner funcs
6050     function getAlternativesForProd(definition) {
6051         const alternatives = possiblePathsFrom(remainingPathWith(definition), maxLength, currPath);
6052         return result.concat(alternatives);
6053     }
6054     /**
6055      * Mandatory productions will halt the loop as the paths computed from their recursive calls will already contain the
6056      * following (rest) of the targetDef.
6057      *
6058      * For optional productions (Option/Repetition/...) the loop will continue to represent the paths that do not include the
6059      * the optional production.
6060      */
6061     while (currPath.length < maxLength && i < targetDef.length) {
6062         const prod = targetDef[i];
6063         /* istanbul ignore else */
6064         if (prod instanceof Alternative) {
6065             return getAlternativesForProd(prod.definition);
6066         }
6067         else if (prod instanceof NonTerminal) {
6068             return getAlternativesForProd(prod.definition);
6069         }
6070         else if (prod instanceof Option) {
6071             result = getAlternativesForProd(prod.definition);
6072         }
6073         else if (prod instanceof RepetitionMandatory) {
6074             const newDef = prod.definition.concat([
6075                 new Repetition({
6076                     definition: prod.definition,
6077                 }),
6078             ]);
6079             return getAlternativesForProd(newDef);
6080         }
6081         else if (prod instanceof RepetitionMandatoryWithSeparator) {
6082             const newDef = [
6083                 new Alternative({ definition: prod.definition }),
6084                 new Repetition({
6085                     definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition),
6086                 }),
6087             ];
6088             return getAlternativesForProd(newDef);
6089         }
6090         else if (prod instanceof RepetitionWithSeparator) {
6091             const newDef = prod.definition.concat([
6092                 new Repetition({
6093                     definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition),
6094                 }),
6095             ]);
6096             result = getAlternativesForProd(newDef);
6097         }
6098         else if (prod instanceof Repetition) {
6099             const newDef = prod.definition.concat([
6100                 new Repetition({
6101                     definition: prod.definition,
6102                 }),
6103             ]);
6104             result = getAlternativesForProd(newDef);
6105         }
6106         else if (prod instanceof Alternation) {
6107             (0,forEach/* default */.Z)(prod.definition, (currAlt) => {
6108                 // TODO: this is a limited check for empty alternatives
6109                 //   It would prevent a common case of infinite loops during parser initialization.
6110                 //   However **in-directly** empty alternatives may still cause issues.
6111                 if ((0,isEmpty/* default */.Z)(currAlt.definition) === false) {
6112                     result = getAlternativesForProd(currAlt.definition);
6113                 }
6114             });
6115             return result;
6116         }
6117         else if (prod instanceof Terminal) {
6118             currPath.push(prod.terminalType);
6119         }
6120         else {
6121             throw Error("non exhaustive match");
6122         }
6123         i++;
6124     }
6125     result.push({
6126         partialPath: currPath,
6127         suffixDef: lodash_es_drop(targetDef, i),
6128     });
6129     return result;
6130 }
6131 function nextPossibleTokensAfter(initialDef, tokenVector, tokMatcher, maxLookAhead) {
6132     const EXIT_NON_TERMINAL = "EXIT_NONE_TERMINAL";
6133     // to avoid creating a new Array each time.
6134     const EXIT_NON_TERMINAL_ARR = [EXIT_NON_TERMINAL];
6135     const EXIT_ALTERNATIVE = "EXIT_ALTERNATIVE";
6136     let foundCompletePath = false;
6137     const tokenVectorLength = tokenVector.length;
6138     const minimalAlternativesIndex = tokenVectorLength - maxLookAhead - 1;
6139     const result = [];
6140     const possiblePaths = [];
6141     possiblePaths.push({
6142         idx: -1,
6143         def: initialDef,
6144         ruleStack: [],
6145         occurrenceStack: [],
6146     });
6147     while (!(0,isEmpty/* default */.Z)(possiblePaths)) {
6148         const currPath = possiblePaths.pop();
6149         // skip alternatives if no more results can be found (assuming deterministic grammar with fixed lookahead)
6150         if (currPath === EXIT_ALTERNATIVE) {
6151             if (foundCompletePath &&
6152                 (0,last/* default */.Z)(possiblePaths).idx <= minimalAlternativesIndex) {
6153                 // remove irrelevant alternative
6154                 possiblePaths.pop();
6155             }
6156             continue;
6157         }
6158         const currDef = currPath.def;
6159         const currIdx = currPath.idx;
6160         const currRuleStack = currPath.ruleStack;
6161         const currOccurrenceStack = currPath.occurrenceStack;
6162         // For Example: an empty path could exist in a valid grammar in the case of an EMPTY_ALT
6163         if ((0,isEmpty/* default */.Z)(currDef)) {
6164             continue;
6165         }
6166         const prod = currDef[0];
6167         /* istanbul ignore else */
6168         if (prod === EXIT_NON_TERMINAL) {
6169             const nextPath = {
6170                 idx: currIdx,
6171                 def: lodash_es_drop(currDef),
6172                 ruleStack: lodash_es_dropRight(currRuleStack),
6173                 occurrenceStack: lodash_es_dropRight(currOccurrenceStack),
6174             };
6175             possiblePaths.push(nextPath);
6176         }
6177         else if (prod instanceof Terminal) {
6178             /* istanbul ignore else */
6179             if (currIdx < tokenVectorLength - 1) {
6180                 const nextIdx = currIdx + 1;
6181                 const actualToken = tokenVector[nextIdx];
6182                 if (tokMatcher(actualToken, prod.terminalType)) {
6183                     const nextPath = {
6184                         idx: nextIdx,
6185                         def: lodash_es_drop(currDef),
6186                         ruleStack: currRuleStack,
6187                         occurrenceStack: currOccurrenceStack,
6188                     };
6189                     possiblePaths.push(nextPath);
6190                 }
6191                 // end of the line
6192             }
6193             else if (currIdx === tokenVectorLength - 1) {
6194                 // IGNORE ABOVE ELSE
6195                 result.push({
6196                     nextTokenType: prod.terminalType,
6197                     nextTokenOccurrence: prod.idx,
6198                     ruleStack: currRuleStack,
6199                     occurrenceStack: currOccurrenceStack,
6200                 });
6201                 foundCompletePath = true;
6202             }
6203             else {
6204                 throw Error("non exhaustive match");
6205             }
6206         }
6207         else if (prod instanceof NonTerminal) {
6208             const newRuleStack = (0,lodash_es_clone/* default */.Z)(currRuleStack);
6209             newRuleStack.push(prod.nonTerminalName);
6210             const newOccurrenceStack = (0,lodash_es_clone/* default */.Z)(currOccurrenceStack);
6211             newOccurrenceStack.push(prod.idx);
6212             const nextPath = {
6213                 idx: currIdx,
6214                 def: prod.definition.concat(EXIT_NON_TERMINAL_ARR, lodash_es_drop(currDef)),
6215                 ruleStack: newRuleStack,
6216                 occurrenceStack: newOccurrenceStack,
6217             };
6218             possiblePaths.push(nextPath);
6219         }
6220         else if (prod instanceof Option) {
6221             // the order of alternatives is meaningful, FILO (Last path will be traversed first).
6222             const nextPathWithout = {
6223                 idx: currIdx,
6224                 def: lodash_es_drop(currDef),
6225                 ruleStack: currRuleStack,
6226                 occurrenceStack: currOccurrenceStack,
6227             };
6228             possiblePaths.push(nextPathWithout);
6229             // required marker to avoid backtracking paths whose higher priority alternatives already matched
6230             possiblePaths.push(EXIT_ALTERNATIVE);
6231             const nextPathWith = {
6232                 idx: currIdx,
6233                 def: prod.definition.concat(lodash_es_drop(currDef)),
6234                 ruleStack: currRuleStack,
6235                 occurrenceStack: currOccurrenceStack,
6236             };
6237             possiblePaths.push(nextPathWith);
6238         }
6239         else if (prod instanceof RepetitionMandatory) {
6240             // TODO:(THE NEW operators here take a while...) (convert once?)
6241             const secondIteration = new Repetition({
6242                 definition: prod.definition,
6243                 idx: prod.idx,
6244             });
6245             const nextDef = prod.definition.concat([secondIteration], lodash_es_drop(currDef));
6246             const nextPath = {
6247                 idx: currIdx,
6248                 def: nextDef,
6249                 ruleStack: currRuleStack,
6250                 occurrenceStack: currOccurrenceStack,
6251             };
6252             possiblePaths.push(nextPath);
6253         }
6254         else if (prod instanceof RepetitionMandatoryWithSeparator) {
6255             // TODO:(THE NEW operators here take a while...) (convert once?)
6256             const separatorGast = new Terminal({
6257                 terminalType: prod.separator,
6258             });
6259             const secondIteration = new Repetition({
6260                 definition: [separatorGast].concat(prod.definition),
6261                 idx: prod.idx,
6262             });
6263             const nextDef = prod.definition.concat([secondIteration], lodash_es_drop(currDef));
6264             const nextPath = {
6265                 idx: currIdx,
6266                 def: nextDef,
6267                 ruleStack: currRuleStack,
6268                 occurrenceStack: currOccurrenceStack,
6269             };
6270             possiblePaths.push(nextPath);
6271         }
6272         else if (prod instanceof RepetitionWithSeparator) {
6273             // the order of alternatives is meaningful, FILO (Last path will be traversed first).
6274             const nextPathWithout = {
6275                 idx: currIdx,
6276                 def: lodash_es_drop(currDef),
6277                 ruleStack: currRuleStack,
6278                 occurrenceStack: currOccurrenceStack,
6279             };
6280             possiblePaths.push(nextPathWithout);
6281             // required marker to avoid backtracking paths whose higher priority alternatives already matched
6282             possiblePaths.push(EXIT_ALTERNATIVE);
6283             const separatorGast = new Terminal({
6284                 terminalType: prod.separator,
6285             });
6286             const nthRepetition = new Repetition({
6287                 definition: [separatorGast].concat(prod.definition),
6288                 idx: prod.idx,
6289             });
6290             const nextDef = prod.definition.concat([nthRepetition], lodash_es_drop(currDef));
6291             const nextPathWith = {
6292                 idx: currIdx,
6293                 def: nextDef,
6294                 ruleStack: currRuleStack,
6295                 occurrenceStack: currOccurrenceStack,
6296             };
6297             possiblePaths.push(nextPathWith);
6298         }
6299         else if (prod instanceof Repetition) {
6300             // the order of alternatives is meaningful, FILO (Last path will be traversed first).
6301             const nextPathWithout = {
6302                 idx: currIdx,
6303                 def: lodash_es_drop(currDef),
6304                 ruleStack: currRuleStack,
6305                 occurrenceStack: currOccurrenceStack,
6306             };
6307             possiblePaths.push(nextPathWithout);
6308             // required marker to avoid backtracking paths whose higher priority alternatives already matched
6309             possiblePaths.push(EXIT_ALTERNATIVE);
6310             // TODO: an empty repetition will cause infinite loops here, will the parser detect this in selfAnalysis?
6311             const nthRepetition = new Repetition({
6312                 definition: prod.definition,
6313                 idx: prod.idx,
6314             });
6315             const nextDef = prod.definition.concat([nthRepetition], lodash_es_drop(currDef));
6316             const nextPathWith = {
6317                 idx: currIdx,
6318                 def: nextDef,
6319                 ruleStack: currRuleStack,
6320                 occurrenceStack: currOccurrenceStack,
6321             };
6322             possiblePaths.push(nextPathWith);
6323         }
6324         else if (prod instanceof Alternation) {
6325             // the order of alternatives is meaningful, FILO (Last path will be traversed first).
6326             for (let i = prod.definition.length - 1; i >= 0; i--) {
6327                 const currAlt = prod.definition[i];
6328                 const currAltPath = {
6329                     idx: currIdx,
6330                     def: currAlt.definition.concat(lodash_es_drop(currDef)),
6331                     ruleStack: currRuleStack,
6332                     occurrenceStack: currOccurrenceStack,
6333                 };
6334                 possiblePaths.push(currAltPath);
6335                 possiblePaths.push(EXIT_ALTERNATIVE);
6336             }
6337         }
6338         else if (prod instanceof Alternative) {
6339             possiblePaths.push({
6340                 idx: currIdx,
6341                 def: prod.definition.concat(lodash_es_drop(currDef)),
6342                 ruleStack: currRuleStack,
6343                 occurrenceStack: currOccurrenceStack,
6344             });
6345         }
6346         else if (prod instanceof Rule) {
6347             // last because we should only encounter at most a single one of these per invocation.
6348             possiblePaths.push(expandTopLevelRule(prod, currIdx, currRuleStack, currOccurrenceStack));
6349         }
6350         else {
6351             throw Error("non exhaustive match");
6352         }
6353     }
6354     return result;
6355 }
6356 function expandTopLevelRule(topRule, currIdx, currRuleStack, currOccurrenceStack) {
6357     const newRuleStack = (0,lodash_es_clone/* default */.Z)(currRuleStack);
6358     newRuleStack.push(topRule.name);
6359     const newCurrOccurrenceStack = (0,lodash_es_clone/* default */.Z)(currOccurrenceStack);
6360     // top rule is always assumed to have been called with occurrence index 1
6361     newCurrOccurrenceStack.push(1);
6362     return {
6363         idx: currIdx,
6364         def: topRule.definition,
6365         ruleStack: newRuleStack,
6366         occurrenceStack: newCurrOccurrenceStack,
6367     };
6368 }
6369 //# sourceMappingURL=interpreter.js.map
6370 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/grammar/lookahead.js
6371 
6372 
6373 
6374 
6375 
6376 var PROD_TYPE;
6377 (function (PROD_TYPE) {
6378     PROD_TYPE[PROD_TYPE["OPTION"] = 0] = "OPTION";
6379     PROD_TYPE[PROD_TYPE["REPETITION"] = 1] = "REPETITION";
6380     PROD_TYPE[PROD_TYPE["REPETITION_MANDATORY"] = 2] = "REPETITION_MANDATORY";
6381     PROD_TYPE[PROD_TYPE["REPETITION_MANDATORY_WITH_SEPARATOR"] = 3] = "REPETITION_MANDATORY_WITH_SEPARATOR";
6382     PROD_TYPE[PROD_TYPE["REPETITION_WITH_SEPARATOR"] = 4] = "REPETITION_WITH_SEPARATOR";
6383     PROD_TYPE[PROD_TYPE["ALTERNATION"] = 5] = "ALTERNATION";
6384 })(PROD_TYPE || (PROD_TYPE = {}));
6385 function getProdType(prod) {
6386     /* istanbul ignore else */
6387     if (prod instanceof Option || prod === "Option") {
6388         return PROD_TYPE.OPTION;
6389     }
6390     else if (prod instanceof Repetition || prod === "Repetition") {
6391         return PROD_TYPE.REPETITION;
6392     }
6393     else if (prod instanceof RepetitionMandatory ||
6394         prod === "RepetitionMandatory") {
6395         return PROD_TYPE.REPETITION_MANDATORY;
6396     }
6397     else if (prod instanceof RepetitionMandatoryWithSeparator ||
6398         prod === "RepetitionMandatoryWithSeparator") {
6399         return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR;
6400     }
6401     else if (prod instanceof RepetitionWithSeparator ||
6402         prod === "RepetitionWithSeparator") {
6403         return PROD_TYPE.REPETITION_WITH_SEPARATOR;
6404     }
6405     else if (prod instanceof Alternation || prod === "Alternation") {
6406         return PROD_TYPE.ALTERNATION;
6407     }
6408     else {
6409         throw Error("non exhaustive match");
6410     }
6411 }
6412 function getLookaheadPaths(options) {
6413     const { occurrence, rule, prodType, maxLookahead } = options;
6414     const type = getProdType(prodType);
6415     if (type === PROD_TYPE.ALTERNATION) {
6416         return getLookaheadPathsForOr(occurrence, rule, maxLookahead);
6417     }
6418     else {
6419         return getLookaheadPathsForOptionalProd(occurrence, rule, type, maxLookahead);
6420     }
6421 }
6422 function buildLookaheadFuncForOr(occurrence, ruleGrammar, maxLookahead, hasPredicates, dynamicTokensEnabled, laFuncBuilder) {
6423     const lookAheadPaths = getLookaheadPathsForOr(occurrence, ruleGrammar, maxLookahead);
6424     const tokenMatcher = areTokenCategoriesNotUsed(lookAheadPaths)
6425         ? tokenStructuredMatcherNoCategories
6426         : tokenStructuredMatcher;
6427     return laFuncBuilder(lookAheadPaths, hasPredicates, tokenMatcher, dynamicTokensEnabled);
6428 }
6429 /**
6430  *  When dealing with an Optional production (OPTION/MANY/2nd iteration of AT_LEAST_ONE/...) we need to compare
6431  *  the lookahead "inside" the production and the lookahead immediately "after" it in the same top level rule (context free).
6432  *
6433  *  Example: given a production:
6434  *  ABC(DE)?DF
6435  *
6436  *  The optional '(DE)?' should only be entered if we see 'DE'. a single Token 'D' is not sufficient to distinguish between the two
6437  *  alternatives.
6438  *
6439  *  @returns A Lookahead function which will return true IFF the parser should parse the Optional production.
6440  */
6441 function buildLookaheadFuncForOptionalProd(occurrence, ruleGrammar, k, dynamicTokensEnabled, prodType, lookaheadBuilder) {
6442     const lookAheadPaths = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k);
6443     const tokenMatcher = areTokenCategoriesNotUsed(lookAheadPaths)
6444         ? tokenStructuredMatcherNoCategories
6445         : tokenStructuredMatcher;
6446     return lookaheadBuilder(lookAheadPaths[0], tokenMatcher, dynamicTokensEnabled);
6447 }
6448 function buildAlternativesLookAheadFunc(alts, hasPredicates, tokenMatcher, dynamicTokensEnabled) {
6449     const numOfAlts = alts.length;
6450     const areAllOneTokenLookahead = lodash_es_every(alts, (currAlt) => {
6451         return lodash_es_every(currAlt, (currPath) => {
6452             return currPath.length === 1;
6453         });
6454     });
6455     // This version takes into account the predicates as well.
6456     if (hasPredicates) {
6457         /**
6458          * @returns {number} - The chosen alternative index
6459          */
6460         return function (orAlts) {
6461             // unfortunately the predicates must be extracted every single time
6462             // as they cannot be cached due to references to parameters(vars) which are no longer valid.
6463             // note that in the common case of no predicates, no cpu time will be wasted on this (see else block)
6464             const predicates = (0,map/* default */.Z)(orAlts, (currAlt) => currAlt.GATE);
6465             for (let t = 0; t < numOfAlts; t++) {
6466                 const currAlt = alts[t];
6467                 const currNumOfPaths = currAlt.length;
6468                 const currPredicate = predicates[t];
6469                 if (currPredicate !== undefined && currPredicate.call(this) === false) {
6470                     // if the predicate does not match there is no point in checking the paths
6471                     continue;
6472                 }
6473                 nextPath: for (let j = 0; j < currNumOfPaths; j++) {
6474                     const currPath = currAlt[j];
6475                     const currPathLength = currPath.length;
6476                     for (let i = 0; i < currPathLength; i++) {
6477                         const nextToken = this.LA(i + 1);
6478                         if (tokenMatcher(nextToken, currPath[i]) === false) {
6479                             // mismatch in current path
6480                             // try the next pth
6481                             continue nextPath;
6482                         }
6483                     }
6484                     // found a full path that matches.
6485                     // this will also work for an empty ALT as the loop will be skipped
6486                     return t;
6487                 }
6488                 // none of the paths for the current alternative matched
6489                 // try the next alternative
6490             }
6491             // none of the alternatives could be matched
6492             return undefined;
6493         };
6494     }
6495     else if (areAllOneTokenLookahead && !dynamicTokensEnabled) {
6496         // optimized (common) case of all the lookaheads paths requiring only
6497         // a single token lookahead. These Optimizations cannot work if dynamically defined Tokens are used.
6498         const singleTokenAlts = (0,map/* default */.Z)(alts, (currAlt) => {
6499             return (0,flatten/* default */.Z)(currAlt);
6500         });
6501         const choiceToAlt = (0,reduce/* default */.Z)(singleTokenAlts, (result, currAlt, idx) => {
6502             (0,forEach/* default */.Z)(currAlt, (currTokType) => {
6503                 if (!(0,has/* default */.Z)(result, currTokType.tokenTypeIdx)) {
6504                     result[currTokType.tokenTypeIdx] = idx;
6505                 }
6506                 (0,forEach/* default */.Z)(currTokType.categoryMatches, (currExtendingType) => {
6507                     if (!(0,has/* default */.Z)(result, currExtendingType)) {
6508                         result[currExtendingType] = idx;
6509                     }
6510                 });
6511             });
6512             return result;
6513         }, {});
6514         /**
6515          * @returns {number} - The chosen alternative index
6516          */
6517         return function () {
6518             const nextToken = this.LA(1);
6519             return choiceToAlt[nextToken.tokenTypeIdx];
6520         };
6521     }
6522     else {
6523         // optimized lookahead without needing to check the predicates at all.
6524         // this causes code duplication which is intentional to improve performance.
6525         /**
6526          * @returns {number} - The chosen alternative index
6527          */
6528         return function () {
6529             for (let t = 0; t < numOfAlts; t++) {
6530                 const currAlt = alts[t];
6531                 const currNumOfPaths = currAlt.length;
6532                 nextPath: for (let j = 0; j < currNumOfPaths; j++) {
6533                     const currPath = currAlt[j];
6534                     const currPathLength = currPath.length;
6535                     for (let i = 0; i < currPathLength; i++) {
6536                         const nextToken = this.LA(i + 1);
6537                         if (tokenMatcher(nextToken, currPath[i]) === false) {
6538                             // mismatch in current path
6539                             // try the next pth
6540                             continue nextPath;
6541                         }
6542                     }
6543                     // found a full path that matches.
6544                     // this will also work for an empty ALT as the loop will be skipped
6545                     return t;
6546                 }
6547                 // none of the paths for the current alternative matched
6548                 // try the next alternative
6549             }
6550             // none of the alternatives could be matched
6551             return undefined;
6552         };
6553     }
6554 }
6555 function buildSingleAlternativeLookaheadFunction(alt, tokenMatcher, dynamicTokensEnabled) {
6556     const areAllOneTokenLookahead = lodash_es_every(alt, (currPath) => {
6557         return currPath.length === 1;
6558     });
6559     const numOfPaths = alt.length;
6560     // optimized (common) case of all the lookaheads paths requiring only
6561     // a single token lookahead.
6562     if (areAllOneTokenLookahead && !dynamicTokensEnabled) {
6563         const singleTokensTypes = (0,flatten/* default */.Z)(alt);
6564         if (singleTokensTypes.length === 1 &&
6565             (0,isEmpty/* default */.Z)(singleTokensTypes[0].categoryMatches)) {
6566             const expectedTokenType = singleTokensTypes[0];
6567             const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx;
6568             return function () {
6569                 return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey;
6570             };
6571         }
6572         else {
6573             const choiceToAlt = (0,reduce/* default */.Z)(singleTokensTypes, (result, currTokType, idx) => {
6574                 result[currTokType.tokenTypeIdx] = true;
6575                 (0,forEach/* default */.Z)(currTokType.categoryMatches, (currExtendingType) => {
6576                     result[currExtendingType] = true;
6577                 });
6578                 return result;
6579             }, []);
6580             return function () {
6581                 const nextToken = this.LA(1);
6582                 return choiceToAlt[nextToken.tokenTypeIdx] === true;
6583             };
6584         }
6585     }
6586     else {
6587         return function () {
6588             nextPath: for (let j = 0; j < numOfPaths; j++) {
6589                 const currPath = alt[j];
6590                 const currPathLength = currPath.length;
6591                 for (let i = 0; i < currPathLength; i++) {
6592                     const nextToken = this.LA(i + 1);
6593                     if (tokenMatcher(nextToken, currPath[i]) === false) {
6594                         // mismatch in current path
6595                         // try the next pth
6596                         continue nextPath;
6597                     }
6598                 }
6599                 // found a full path that matches.
6600                 return true;
6601             }
6602             // none of the paths matched
6603             return false;
6604         };
6605     }
6606 }
6607 class RestDefinitionFinderWalker extends RestWalker {
6608     constructor(topProd, targetOccurrence, targetProdType) {
6609         super();
6610         this.topProd = topProd;
6611         this.targetOccurrence = targetOccurrence;
6612         this.targetProdType = targetProdType;
6613     }
6614     startWalking() {
6615         this.walk(this.topProd);
6616         return this.restDef;
6617     }
6618     checkIsTarget(node, expectedProdType, currRest, prevRest) {
6619         if (node.idx === this.targetOccurrence &&
6620             this.targetProdType === expectedProdType) {
6621             this.restDef = currRest.concat(prevRest);
6622             return true;
6623         }
6624         // performance optimization, do not iterate over the entire Grammar ast after we have found the target
6625         return false;
6626     }
6627     walkOption(optionProd, currRest, prevRest) {
6628         if (!this.checkIsTarget(optionProd, PROD_TYPE.OPTION, currRest, prevRest)) {
6629             super.walkOption(optionProd, currRest, prevRest);
6630         }
6631     }
6632     walkAtLeastOne(atLeastOneProd, currRest, prevRest) {
6633         if (!this.checkIsTarget(atLeastOneProd, PROD_TYPE.REPETITION_MANDATORY, currRest, prevRest)) {
6634             super.walkOption(atLeastOneProd, currRest, prevRest);
6635         }
6636     }
6637     walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) {
6638         if (!this.checkIsTarget(atLeastOneSepProd, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, currRest, prevRest)) {
6639             super.walkOption(atLeastOneSepProd, currRest, prevRest);
6640         }
6641     }
6642     walkMany(manyProd, currRest, prevRest) {
6643         if (!this.checkIsTarget(manyProd, PROD_TYPE.REPETITION, currRest, prevRest)) {
6644             super.walkOption(manyProd, currRest, prevRest);
6645         }
6646     }
6647     walkManySep(manySepProd, currRest, prevRest) {
6648         if (!this.checkIsTarget(manySepProd, PROD_TYPE.REPETITION_WITH_SEPARATOR, currRest, prevRest)) {
6649             super.walkOption(manySepProd, currRest, prevRest);
6650         }
6651     }
6652 }
6653 /**
6654  * Returns the definition of a target production in a top level level rule.
6655  */
6656 class InsideDefinitionFinderVisitor extends GAstVisitor {
6657     constructor(targetOccurrence, targetProdType, targetRef) {
6658         super();
6659         this.targetOccurrence = targetOccurrence;
6660         this.targetProdType = targetProdType;
6661         this.targetRef = targetRef;
6662         this.result = [];
6663     }
6664     checkIsTarget(node, expectedProdName) {
6665         if (node.idx === this.targetOccurrence &&
6666             this.targetProdType === expectedProdName &&
6667             (this.targetRef === undefined || node === this.targetRef)) {
6668             this.result = node.definition;
6669         }
6670     }
6671     visitOption(node) {
6672         this.checkIsTarget(node, PROD_TYPE.OPTION);
6673     }
6674     visitRepetition(node) {
6675         this.checkIsTarget(node, PROD_TYPE.REPETITION);
6676     }
6677     visitRepetitionMandatory(node) {
6678         this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY);
6679     }
6680     visitRepetitionMandatoryWithSeparator(node) {
6681         this.checkIsTarget(node, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR);
6682     }
6683     visitRepetitionWithSeparator(node) {
6684         this.checkIsTarget(node, PROD_TYPE.REPETITION_WITH_SEPARATOR);
6685     }
6686     visitAlternation(node) {
6687         this.checkIsTarget(node, PROD_TYPE.ALTERNATION);
6688     }
6689 }
6690 function initializeArrayOfArrays(size) {
6691     const result = new Array(size);
6692     for (let i = 0; i < size; i++) {
6693         result[i] = [];
6694     }
6695     return result;
6696 }
6697 /**
6698  * A sort of hash function between a Path in the grammar and a string.
6699  * Note that this returns multiple "hashes" to support the scenario of token categories.
6700  * -  A single path with categories may match multiple **actual** paths.
6701  */
6702 function pathToHashKeys(path) {
6703     let keys = [""];
6704     for (let i = 0; i < path.length; i++) {
6705         const tokType = path[i];
6706         const longerKeys = [];
6707         for (let j = 0; j < keys.length; j++) {
6708             const currShorterKey = keys[j];
6709             longerKeys.push(currShorterKey + "_" + tokType.tokenTypeIdx);
6710             for (let t = 0; t < tokType.categoryMatches.length; t++) {
6711                 const categoriesKeySuffix = "_" + tokType.categoryMatches[t];
6712                 longerKeys.push(currShorterKey + categoriesKeySuffix);
6713             }
6714         }
6715         keys = longerKeys;
6716     }
6717     return keys;
6718 }
6719 /**
6720  * Imperative style due to being called from a hot spot
6721  */
6722 function isUniquePrefixHash(altKnownPathsKeys, searchPathKeys, idx) {
6723     for (let currAltIdx = 0; currAltIdx < altKnownPathsKeys.length; currAltIdx++) {
6724         // We only want to test vs the other alternatives
6725         if (currAltIdx === idx) {
6726             continue;
6727         }
6728         const otherAltKnownPathsKeys = altKnownPathsKeys[currAltIdx];
6729         for (let searchIdx = 0; searchIdx < searchPathKeys.length; searchIdx++) {
6730             const searchKey = searchPathKeys[searchIdx];
6731             if (otherAltKnownPathsKeys[searchKey] === true) {
6732                 return false;
6733             }
6734         }
6735     }
6736     // None of the SearchPathKeys were found in any of the other alternatives
6737     return true;
6738 }
6739 function lookAheadSequenceFromAlternatives(altsDefs, k) {
6740     const partialAlts = (0,map/* default */.Z)(altsDefs, (currAlt) => possiblePathsFrom([currAlt], 1));
6741     const finalResult = initializeArrayOfArrays(partialAlts.length);
6742     const altsHashes = (0,map/* default */.Z)(partialAlts, (currAltPaths) => {
6743         const dict = {};
6744         (0,forEach/* default */.Z)(currAltPaths, (item) => {
6745             const keys = pathToHashKeys(item.partialPath);
6746             (0,forEach/* default */.Z)(keys, (currKey) => {
6747                 dict[currKey] = true;
6748             });
6749         });
6750         return dict;
6751     });
6752     let newData = partialAlts;
6753     // maxLookahead loop
6754     for (let pathLength = 1; pathLength <= k; pathLength++) {
6755         const currDataset = newData;
6756         newData = initializeArrayOfArrays(currDataset.length);
6757         // alternatives loop
6758         for (let altIdx = 0; altIdx < currDataset.length; altIdx++) {
6759             const currAltPathsAndSuffixes = currDataset[altIdx];
6760             // paths in current alternative loop
6761             for (let currPathIdx = 0; currPathIdx < currAltPathsAndSuffixes.length; currPathIdx++) {
6762                 const currPathPrefix = currAltPathsAndSuffixes[currPathIdx].partialPath;
6763                 const suffixDef = currAltPathsAndSuffixes[currPathIdx].suffixDef;
6764                 const prefixKeys = pathToHashKeys(currPathPrefix);
6765                 const isUnique = isUniquePrefixHash(altsHashes, prefixKeys, altIdx);
6766                 // End of the line for this path.
6767                 if (isUnique || (0,isEmpty/* default */.Z)(suffixDef) || currPathPrefix.length === k) {
6768                     const currAltResult = finalResult[altIdx];
6769                     // TODO: Can we implement a containsPath using Maps/Dictionaries?
6770                     if (containsPath(currAltResult, currPathPrefix) === false) {
6771                         currAltResult.push(currPathPrefix);
6772                         // Update all new  keys for the current path.
6773                         for (let j = 0; j < prefixKeys.length; j++) {
6774                             const currKey = prefixKeys[j];
6775                             altsHashes[altIdx][currKey] = true;
6776                         }
6777                     }
6778                 }
6779                 // Expand longer paths
6780                 else {
6781                     const newPartialPathsAndSuffixes = possiblePathsFrom(suffixDef, pathLength + 1, currPathPrefix);
6782                     newData[altIdx] = newData[altIdx].concat(newPartialPathsAndSuffixes);
6783                     // Update keys for new known paths
6784                     (0,forEach/* default */.Z)(newPartialPathsAndSuffixes, (item) => {
6785                         const prefixKeys = pathToHashKeys(item.partialPath);
6786                         (0,forEach/* default */.Z)(prefixKeys, (key) => {
6787                             altsHashes[altIdx][key] = true;
6788                         });
6789                     });
6790                 }
6791             }
6792         }
6793     }
6794     return finalResult;
6795 }
6796 function getLookaheadPathsForOr(occurrence, ruleGrammar, k, orProd) {
6797     const visitor = new InsideDefinitionFinderVisitor(occurrence, PROD_TYPE.ALTERNATION, orProd);
6798     ruleGrammar.accept(visitor);
6799     return lookAheadSequenceFromAlternatives(visitor.result, k);
6800 }
6801 function getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k) {
6802     const insideDefVisitor = new InsideDefinitionFinderVisitor(occurrence, prodType);
6803     ruleGrammar.accept(insideDefVisitor);
6804     const insideDef = insideDefVisitor.result;
6805     const afterDefWalker = new RestDefinitionFinderWalker(ruleGrammar, occurrence, prodType);
6806     const afterDef = afterDefWalker.startWalking();
6807     const insideFlat = new Alternative({ definition: insideDef });
6808     const afterFlat = new Alternative({ definition: afterDef });
6809     return lookAheadSequenceFromAlternatives([insideFlat, afterFlat], k);
6810 }
6811 function containsPath(alternative, searchPath) {
6812     compareOtherPath: for (let i = 0; i < alternative.length; i++) {
6813         const otherPath = alternative[i];
6814         if (otherPath.length !== searchPath.length) {
6815             continue;
6816         }
6817         for (let j = 0; j < otherPath.length; j++) {
6818             const searchTok = searchPath[j];
6819             const otherTok = otherPath[j];
6820             const matchingTokens = searchTok === otherTok ||
6821                 otherTok.categoryMatchesMap[searchTok.tokenTypeIdx] !== undefined;
6822             if (matchingTokens === false) {
6823                 continue compareOtherPath;
6824             }
6825         }
6826         return true;
6827     }
6828     return false;
6829 }
6830 function isStrictPrefixOfPath(prefix, other) {
6831     return (prefix.length < other.length &&
6832         lodash_es_every(prefix, (tokType, idx) => {
6833             const otherTokType = other[idx];
6834             return (tokType === otherTokType ||
6835                 otherTokType.categoryMatchesMap[tokType.tokenTypeIdx]);
6836         }));
6837 }
6838 function areTokenCategoriesNotUsed(lookAheadPaths) {
6839     return lodash_es_every(lookAheadPaths, (singleAltPaths) => lodash_es_every(singleAltPaths, (singlePath) => lodash_es_every(singlePath, (token) => (0,isEmpty/* default */.Z)(token.categoryMatches))));
6840 }
6841 //# sourceMappingURL=lookahead.js.map
6842 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/grammar/checks.js
6843 
6844 
6845 
6846 
6847 
6848 
6849 function validateLookahead(options) {
6850     const lookaheadValidationErrorMessages = options.lookaheadStrategy.validate({
6851         rules: options.rules,
6852         tokenTypes: options.tokenTypes,
6853         grammarName: options.grammarName,
6854     });
6855     return (0,map/* default */.Z)(lookaheadValidationErrorMessages, (errorMessage) => (Object.assign({ type: ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION }, errorMessage)));
6856 }
6857 function validateGrammar(topLevels, tokenTypes, errMsgProvider, grammarName) {
6858     const duplicateErrors = (0,flatMap/* default */.Z)(topLevels, (currTopLevel) => validateDuplicateProductions(currTopLevel, errMsgProvider));
6859     const termsNamespaceConflictErrors = checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider);
6860     const tooManyAltsErrors = (0,flatMap/* default */.Z)(topLevels, (curRule) => validateTooManyAlts(curRule, errMsgProvider));
6861     const duplicateRulesError = (0,flatMap/* default */.Z)(topLevels, (curRule) => validateRuleDoesNotAlreadyExist(curRule, topLevels, grammarName, errMsgProvider));
6862     return duplicateErrors.concat(termsNamespaceConflictErrors, tooManyAltsErrors, duplicateRulesError);
6863 }
6864 function validateDuplicateProductions(topLevelRule, errMsgProvider) {
6865     const collectorVisitor = new OccurrenceValidationCollector();
6866     topLevelRule.accept(collectorVisitor);
6867     const allRuleProductions = collectorVisitor.allProductions;
6868     const productionGroups = lodash_es_groupBy(allRuleProductions, identifyProductionForDuplicates);
6869     const duplicates = lodash_es_pickBy(productionGroups, (currGroup) => {
6870         return currGroup.length > 1;
6871     });
6872     const errors = (0,map/* default */.Z)((0,values/* default */.Z)(duplicates), (currDuplicates) => {
6873         const firstProd = lodash_es_head(currDuplicates);
6874         const msg = errMsgProvider.buildDuplicateFoundError(topLevelRule, currDuplicates);
6875         const dslName = getProductionDslName(firstProd);
6876         const defError = {
6877             message: msg,
6878             type: ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,
6879             ruleName: topLevelRule.name,
6880             dslName: dslName,
6881             occurrence: firstProd.idx,
6882         };
6883         const param = getExtraProductionArgument(firstProd);
6884         if (param) {
6885             defError.parameter = param;
6886         }
6887         return defError;
6888     });
6889     return errors;
6890 }
6891 function identifyProductionForDuplicates(prod) {
6892     return `${getProductionDslName(prod)}_#_${prod.idx}_#_${getExtraProductionArgument(prod)}`;
6893 }
6894 function getExtraProductionArgument(prod) {
6895     if (prod instanceof Terminal) {
6896         return prod.terminalType.name;
6897     }
6898     else if (prod instanceof NonTerminal) {
6899         return prod.nonTerminalName;
6900     }
6901     else {
6902         return "";
6903     }
6904 }
6905 class OccurrenceValidationCollector extends GAstVisitor {
6906     constructor() {
6907         super(...arguments);
6908         this.allProductions = [];
6909     }
6910     visitNonTerminal(subrule) {
6911         this.allProductions.push(subrule);
6912     }
6913     visitOption(option) {
6914         this.allProductions.push(option);
6915     }
6916     visitRepetitionWithSeparator(manySep) {
6917         this.allProductions.push(manySep);
6918     }
6919     visitRepetitionMandatory(atLeastOne) {
6920         this.allProductions.push(atLeastOne);
6921     }
6922     visitRepetitionMandatoryWithSeparator(atLeastOneSep) {
6923         this.allProductions.push(atLeastOneSep);
6924     }
6925     visitRepetition(many) {
6926         this.allProductions.push(many);
6927     }
6928     visitAlternation(or) {
6929         this.allProductions.push(or);
6930     }
6931     visitTerminal(terminal) {
6932         this.allProductions.push(terminal);
6933     }
6934 }
6935 function validateRuleDoesNotAlreadyExist(rule, allRules, className, errMsgProvider) {
6936     const errors = [];
6937     const occurrences = (0,reduce/* default */.Z)(allRules, (result, curRule) => {
6938         if (curRule.name === rule.name) {
6939             return result + 1;
6940         }
6941         return result;
6942     }, 0);
6943     if (occurrences > 1) {
6944         const errMsg = errMsgProvider.buildDuplicateRuleNameError({
6945             topLevelRule: rule,
6946             grammarName: className,
6947         });
6948         errors.push({
6949             message: errMsg,
6950             type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME,
6951             ruleName: rule.name,
6952         });
6953     }
6954     return errors;
6955 }
6956 // TODO: is there anyway to get only the rule names of rules inherited from the super grammars?
6957 // This is not part of the IGrammarErrorProvider because the validation cannot be performed on
6958 // The grammar structure, only at runtime.
6959 function validateRuleIsOverridden(ruleName, definedRulesNames, className) {
6960     const errors = [];
6961     let errMsg;
6962     if (!lodash_es_includes(definedRulesNames, ruleName)) {
6963         errMsg =
6964             `Invalid rule override, rule: ->${ruleName}<- cannot be overridden in the grammar: ->${className}<-` +
6965                 `as it is not defined in any of the super grammars `;
6966         errors.push({
6967             message: errMsg,
6968             type: ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,
6969             ruleName: ruleName,
6970         });
6971     }
6972     return errors;
6973 }
6974 function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path = []) {
6975     const errors = [];
6976     const nextNonTerminals = getFirstNoneTerminal(currRule.definition);
6977     if ((0,isEmpty/* default */.Z)(nextNonTerminals)) {
6978         return [];
6979     }
6980     else {
6981         const ruleName = topRule.name;
6982         const foundLeftRecursion = lodash_es_includes(nextNonTerminals, topRule);
6983         if (foundLeftRecursion) {
6984             errors.push({
6985                 message: errMsgProvider.buildLeftRecursionError({
6986                     topLevelRule: topRule,
6987                     leftRecursionPath: path,
6988                 }),
6989                 type: ParserDefinitionErrorType.LEFT_RECURSION,
6990                 ruleName: ruleName,
6991             });
6992         }
6993         // we are only looking for cyclic paths leading back to the specific topRule
6994         // other cyclic paths are ignored, we still need this difference to avoid infinite loops...
6995         const validNextSteps = lodash_es_difference(nextNonTerminals, path.concat([topRule]));
6996         const errorsFromNextSteps = (0,flatMap/* default */.Z)(validNextSteps, (currRefRule) => {
6997             const newPath = (0,lodash_es_clone/* default */.Z)(path);
6998             newPath.push(currRefRule);
6999             return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath);
7000         });
7001         return errors.concat(errorsFromNextSteps);
7002     }
7003 }
7004 function getFirstNoneTerminal(definition) {
7005     let result = [];
7006     if ((0,isEmpty/* default */.Z)(definition)) {
7007         return result;
7008     }
7009     const firstProd = lodash_es_head(definition);
7010     /* istanbul ignore else */
7011     if (firstProd instanceof NonTerminal) {
7012         result.push(firstProd.referencedRule);
7013     }
7014     else if (firstProd instanceof Alternative ||
7015         firstProd instanceof Option ||
7016         firstProd instanceof RepetitionMandatory ||
7017         firstProd instanceof RepetitionMandatoryWithSeparator ||
7018         firstProd instanceof RepetitionWithSeparator ||
7019         firstProd instanceof Repetition) {
7020         result = result.concat(getFirstNoneTerminal(firstProd.definition));
7021     }
7022     else if (firstProd instanceof Alternation) {
7023         // each sub definition in alternation is a FLAT
7024         result = (0,flatten/* default */.Z)((0,map/* default */.Z)(firstProd.definition, (currSubDef) => getFirstNoneTerminal(currSubDef.definition)));
7025     }
7026     else if (firstProd instanceof Terminal) {
7027         // nothing to see, move along
7028     }
7029     else {
7030         throw Error("non exhaustive match");
7031     }
7032     const isFirstOptional = isOptionalProd(firstProd);
7033     const hasMore = definition.length > 1;
7034     if (isFirstOptional && hasMore) {
7035         const rest = lodash_es_drop(definition);
7036         return result.concat(getFirstNoneTerminal(rest));
7037     }
7038     else {
7039         return result;
7040     }
7041 }
7042 class OrCollector extends GAstVisitor {
7043     constructor() {
7044         super(...arguments);
7045         this.alternations = [];
7046     }
7047     visitAlternation(node) {
7048         this.alternations.push(node);
7049     }
7050 }
7051 function validateEmptyOrAlternative(topLevelRule, errMsgProvider) {
7052     const orCollector = new OrCollector();
7053     topLevelRule.accept(orCollector);
7054     const ors = orCollector.alternations;
7055     const errors = (0,flatMap/* default */.Z)(ors, (currOr) => {
7056         const exceptLast = lodash_es_dropRight(currOr.definition);
7057         return (0,flatMap/* default */.Z)(exceptLast, (currAlternative, currAltIdx) => {
7058             const possibleFirstInAlt = nextPossibleTokensAfter([currAlternative], [], tokenStructuredMatcher, 1);
7059             if ((0,isEmpty/* default */.Z)(possibleFirstInAlt)) {
7060                 return [
7061                     {
7062                         message: errMsgProvider.buildEmptyAlternationError({
7063                             topLevelRule: topLevelRule,
7064                             alternation: currOr,
7065                             emptyChoiceIdx: currAltIdx,
7066                         }),
7067                         type: ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,
7068                         ruleName: topLevelRule.name,
7069                         occurrence: currOr.idx,
7070                         alternative: currAltIdx + 1,
7071                     },
7072                 ];
7073             }
7074             else {
7075                 return [];
7076             }
7077         });
7078     });
7079     return errors;
7080 }
7081 function validateAmbiguousAlternationAlternatives(topLevelRule, globalMaxLookahead, errMsgProvider) {
7082     const orCollector = new OrCollector();
7083     topLevelRule.accept(orCollector);
7084     let ors = orCollector.alternations;
7085     // New Handling of ignoring ambiguities
7086     // - https://github.com/chevrotain/chevrotain/issues/869
7087     ors = lodash_es_reject(ors, (currOr) => currOr.ignoreAmbiguities === true);
7088     const errors = (0,flatMap/* default */.Z)(ors, (currOr) => {
7089         const currOccurrence = currOr.idx;
7090         const actualMaxLookahead = currOr.maxLookahead || globalMaxLookahead;
7091         const alternatives = getLookaheadPathsForOr(currOccurrence, topLevelRule, actualMaxLookahead, currOr);
7092         const altsAmbiguityErrors = checkAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider);
7093         const altsPrefixAmbiguityErrors = checkPrefixAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider);
7094         return altsAmbiguityErrors.concat(altsPrefixAmbiguityErrors);
7095     });
7096     return errors;
7097 }
7098 class RepetitionCollector extends GAstVisitor {
7099     constructor() {
7100         super(...arguments);
7101         this.allProductions = [];
7102     }
7103     visitRepetitionWithSeparator(manySep) {
7104         this.allProductions.push(manySep);
7105     }
7106     visitRepetitionMandatory(atLeastOne) {
7107         this.allProductions.push(atLeastOne);
7108     }
7109     visitRepetitionMandatoryWithSeparator(atLeastOneSep) {
7110         this.allProductions.push(atLeastOneSep);
7111     }
7112     visitRepetition(many) {
7113         this.allProductions.push(many);
7114     }
7115 }
7116 function validateTooManyAlts(topLevelRule, errMsgProvider) {
7117     const orCollector = new OrCollector();
7118     topLevelRule.accept(orCollector);
7119     const ors = orCollector.alternations;
7120     const errors = (0,flatMap/* default */.Z)(ors, (currOr) => {
7121         if (currOr.definition.length > 255) {
7122             return [
7123                 {
7124                     message: errMsgProvider.buildTooManyAlternativesError({
7125                         topLevelRule: topLevelRule,
7126                         alternation: currOr,
7127                     }),
7128                     type: ParserDefinitionErrorType.TOO_MANY_ALTS,
7129                     ruleName: topLevelRule.name,
7130                     occurrence: currOr.idx,
7131                 },
7132             ];
7133         }
7134         else {
7135             return [];
7136         }
7137     });
7138     return errors;
7139 }
7140 function validateSomeNonEmptyLookaheadPath(topLevelRules, maxLookahead, errMsgProvider) {
7141     const errors = [];
7142     (0,forEach/* default */.Z)(topLevelRules, (currTopRule) => {
7143         const collectorVisitor = new RepetitionCollector();
7144         currTopRule.accept(collectorVisitor);
7145         const allRuleProductions = collectorVisitor.allProductions;
7146         (0,forEach/* default */.Z)(allRuleProductions, (currProd) => {
7147             const prodType = getProdType(currProd);
7148             const actualMaxLookahead = currProd.maxLookahead || maxLookahead;
7149             const currOccurrence = currProd.idx;
7150             const paths = getLookaheadPathsForOptionalProd(currOccurrence, currTopRule, prodType, actualMaxLookahead);
7151             const pathsInsideProduction = paths[0];
7152             if ((0,isEmpty/* default */.Z)((0,flatten/* default */.Z)(pathsInsideProduction))) {
7153                 const errMsg = errMsgProvider.buildEmptyRepetitionError({
7154                     topLevelRule: currTopRule,
7155                     repetition: currProd,
7156                 });
7157                 errors.push({
7158                     message: errMsg,
7159                     type: ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,
7160                     ruleName: currTopRule.name,
7161                 });
7162             }
7163         });
7164     });
7165     return errors;
7166 }
7167 function checkAlternativesAmbiguities(alternatives, alternation, rule, errMsgProvider) {
7168     const foundAmbiguousPaths = [];
7169     const identicalAmbiguities = (0,reduce/* default */.Z)(alternatives, (result, currAlt, currAltIdx) => {
7170         // ignore (skip) ambiguities with this alternative
7171         if (alternation.definition[currAltIdx].ignoreAmbiguities === true) {
7172             return result;
7173         }
7174         (0,forEach/* default */.Z)(currAlt, (currPath) => {
7175             const altsCurrPathAppearsIn = [currAltIdx];
7176             (0,forEach/* default */.Z)(alternatives, (currOtherAlt, currOtherAltIdx) => {
7177                 if (currAltIdx !== currOtherAltIdx &&
7178                     containsPath(currOtherAlt, currPath) &&
7179                     // ignore (skip) ambiguities with this "other" alternative
7180                     alternation.definition[currOtherAltIdx].ignoreAmbiguities !== true) {
7181                     altsCurrPathAppearsIn.push(currOtherAltIdx);
7182                 }
7183             });
7184             if (altsCurrPathAppearsIn.length > 1 &&
7185                 !containsPath(foundAmbiguousPaths, currPath)) {
7186                 foundAmbiguousPaths.push(currPath);
7187                 result.push({
7188                     alts: altsCurrPathAppearsIn,
7189                     path: currPath,
7190                 });
7191             }
7192         });
7193         return result;
7194     }, []);
7195     const currErrors = (0,map/* default */.Z)(identicalAmbiguities, (currAmbDescriptor) => {
7196         const ambgIndices = (0,map/* default */.Z)(currAmbDescriptor.alts, (currAltIdx) => currAltIdx + 1);
7197         const currMessage = errMsgProvider.buildAlternationAmbiguityError({
7198             topLevelRule: rule,
7199             alternation: alternation,
7200             ambiguityIndices: ambgIndices,
7201             prefixPath: currAmbDescriptor.path,
7202         });
7203         return {
7204             message: currMessage,
7205             type: ParserDefinitionErrorType.AMBIGUOUS_ALTS,
7206             ruleName: rule.name,
7207             occurrence: alternation.idx,
7208             alternatives: currAmbDescriptor.alts,
7209         };
7210     });
7211     return currErrors;
7212 }
7213 function checkPrefixAlternativesAmbiguities(alternatives, alternation, rule, errMsgProvider) {
7214     // flatten
7215     const pathsAndIndices = (0,reduce/* default */.Z)(alternatives, (result, currAlt, idx) => {
7216         const currPathsAndIdx = (0,map/* default */.Z)(currAlt, (currPath) => {
7217             return { idx: idx, path: currPath };
7218         });
7219         return result.concat(currPathsAndIdx);
7220     }, []);
7221     const errors = lodash_es_compact((0,flatMap/* default */.Z)(pathsAndIndices, (currPathAndIdx) => {
7222         const alternativeGast = alternation.definition[currPathAndIdx.idx];
7223         // ignore (skip) ambiguities with this alternative
7224         if (alternativeGast.ignoreAmbiguities === true) {
7225             return [];
7226         }
7227         const targetIdx = currPathAndIdx.idx;
7228         const targetPath = currPathAndIdx.path;
7229         const prefixAmbiguitiesPathsAndIndices = (0,filter/* default */.Z)(pathsAndIndices, (searchPathAndIdx) => {
7230             // prefix ambiguity can only be created from lower idx (higher priority) path
7231             return (
7232             // ignore (skip) ambiguities with this "other" alternative
7233             alternation.definition[searchPathAndIdx.idx].ignoreAmbiguities !==
7234                 true &&
7235                 searchPathAndIdx.idx < targetIdx &&
7236                 // checking for strict prefix because identical lookaheads
7237                 // will be be detected using a different validation.
7238                 isStrictPrefixOfPath(searchPathAndIdx.path, targetPath));
7239         });
7240         const currPathPrefixErrors = (0,map/* default */.Z)(prefixAmbiguitiesPathsAndIndices, (currAmbPathAndIdx) => {
7241             const ambgIndices = [currAmbPathAndIdx.idx + 1, targetIdx + 1];
7242             const occurrence = alternation.idx === 0 ? "" : alternation.idx;
7243             const message = errMsgProvider.buildAlternationPrefixAmbiguityError({
7244                 topLevelRule: rule,
7245                 alternation: alternation,
7246                 ambiguityIndices: ambgIndices,
7247                 prefixPath: currAmbPathAndIdx.path,
7248             });
7249             return {
7250                 message: message,
7251                 type: ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,
7252                 ruleName: rule.name,
7253                 occurrence: occurrence,
7254                 alternatives: ambgIndices,
7255             };
7256         });
7257         return currPathPrefixErrors;
7258     }));
7259     return errors;
7260 }
7261 function checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider) {
7262     const errors = [];
7263     const tokenNames = (0,map/* default */.Z)(tokenTypes, (currToken) => currToken.name);
7264     (0,forEach/* default */.Z)(topLevels, (currRule) => {
7265         const currRuleName = currRule.name;
7266         if (lodash_es_includes(tokenNames, currRuleName)) {
7267             const errMsg = errMsgProvider.buildNamespaceConflictError(currRule);
7268             errors.push({
7269                 message: errMsg,
7270                 type: ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,
7271                 ruleName: currRuleName,
7272             });
7273         }
7274     });
7275     return errors;
7276 }
7277 //# sourceMappingURL=checks.js.map
7278 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js
7279 
7280 
7281 
7282 
7283 function gast_resolver_public_resolveGrammar(options) {
7284     const actualOptions = (0,defaults/* default */.Z)(options, {
7285         errMsgProvider: defaultGrammarResolverErrorProvider,
7286     });
7287     const topRulesTable = {};
7288     (0,forEach/* default */.Z)(options.rules, (rule) => {
7289         topRulesTable[rule.name] = rule;
7290     });
7291     return resolveGrammar(topRulesTable, actualOptions.errMsgProvider);
7292 }
7293 function gast_resolver_public_validateGrammar(options) {
7294     options = (0,defaults/* default */.Z)(options, {
7295         errMsgProvider: defaultGrammarValidatorErrorProvider,
7296     });
7297     return validateGrammar(options.rules, options.tokenTypes, options.errMsgProvider, options.grammarName);
7298 }
7299 //# sourceMappingURL=gast_resolver_public.js.map
7300 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/exceptions_public.js
7301 
7302 const MISMATCHED_TOKEN_EXCEPTION = "MismatchedTokenException";
7303 const NO_VIABLE_ALT_EXCEPTION = "NoViableAltException";
7304 const EARLY_EXIT_EXCEPTION = "EarlyExitException";
7305 const NOT_ALL_INPUT_PARSED_EXCEPTION = "NotAllInputParsedException";
7306 const RECOGNITION_EXCEPTION_NAMES = [
7307     MISMATCHED_TOKEN_EXCEPTION,
7308     NO_VIABLE_ALT_EXCEPTION,
7309     EARLY_EXIT_EXCEPTION,
7310     NOT_ALL_INPUT_PARSED_EXCEPTION,
7311 ];
7312 Object.freeze(RECOGNITION_EXCEPTION_NAMES);
7313 // hacks to bypass no support for custom Errors in javascript/typescript
7314 function isRecognitionException(error) {
7315     // can't do instanceof on hacked custom js exceptions
7316     return lodash_es_includes(RECOGNITION_EXCEPTION_NAMES, error.name);
7317 }
7318 class RecognitionException extends Error {
7319     constructor(message, token) {
7320         super(message);
7321         this.token = token;
7322         this.resyncedTokens = [];
7323         // fix prototype chain when typescript target is ES5
7324         Object.setPrototypeOf(this, new.target.prototype);
7325         /* istanbul ignore next - V8 workaround to remove constructor from stacktrace when typescript target is ES5 */
7326         if (Error.captureStackTrace) {
7327             Error.captureStackTrace(this, this.constructor);
7328         }
7329     }
7330 }
7331 class MismatchedTokenException extends RecognitionException {
7332     constructor(message, token, previousToken) {
7333         super(message, token);
7334         this.previousToken = previousToken;
7335         this.name = MISMATCHED_TOKEN_EXCEPTION;
7336     }
7337 }
7338 class NoViableAltException extends RecognitionException {
7339     constructor(message, token, previousToken) {
7340         super(message, token);
7341         this.previousToken = previousToken;
7342         this.name = NO_VIABLE_ALT_EXCEPTION;
7343     }
7344 }
7345 class NotAllInputParsedException extends RecognitionException {
7346     constructor(message, token) {
7347         super(message, token);
7348         this.name = NOT_ALL_INPUT_PARSED_EXCEPTION;
7349     }
7350 }
7351 class EarlyExitException extends RecognitionException {
7352     constructor(message, token, previousToken) {
7353         super(message, token);
7354         this.previousToken = previousToken;
7355         this.name = EARLY_EXIT_EXCEPTION;
7356     }
7357 }
7358 //# sourceMappingURL=exceptions_public.js.map
7359 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js
7360 
7361 
7362 
7363 
7364 
7365 const EOF_FOLLOW_KEY = {};
7366 const IN_RULE_RECOVERY_EXCEPTION = "InRuleRecoveryException";
7367 class InRuleRecoveryException extends Error {
7368     constructor(message) {
7369         super(message);
7370         this.name = IN_RULE_RECOVERY_EXCEPTION;
7371     }
7372 }
7373 /**
7374  * This trait is responsible for the error recovery and fault tolerant logic
7375  */
7376 class Recoverable {
7377     initRecoverable(config) {
7378         this.firstAfterRepMap = {};
7379         this.resyncFollows = {};
7380         this.recoveryEnabled = (0,has/* default */.Z)(config, "recoveryEnabled")
7381             ? config.recoveryEnabled // assumes end user provides the correct config value/type
7382             : DEFAULT_PARSER_CONFIG.recoveryEnabled;
7383         // performance optimization, NOOP will be inlined which
7384         // effectively means that this optional feature does not exist
7385         // when not used.
7386         if (this.recoveryEnabled) {
7387             this.attemptInRepetitionRecovery = attemptInRepetitionRecovery;
7388         }
7389     }
7390     getTokenToInsert(tokType) {
7391         const tokToInsert = createTokenInstance(tokType, "", NaN, NaN, NaN, NaN, NaN, NaN);
7392         tokToInsert.isInsertedInRecovery = true;
7393         return tokToInsert;
7394     }
7395     canTokenTypeBeInsertedInRecovery(tokType) {
7396         return true;
7397     }
7398     canTokenTypeBeDeletedInRecovery(tokType) {
7399         return true;
7400     }
7401     tryInRepetitionRecovery(grammarRule, grammarRuleArgs, lookAheadFunc, expectedTokType) {
7402         // TODO: can the resyncTokenType be cached?
7403         const reSyncTokType = this.findReSyncTokenType();
7404         const savedLexerState = this.exportLexerState();
7405         const resyncedTokens = [];
7406         let passedResyncPoint = false;
7407         const nextTokenWithoutResync = this.LA(1);
7408         let currToken = this.LA(1);
7409         const generateErrorMessage = () => {
7410             const previousToken = this.LA(0);
7411             // we are preemptively re-syncing before an error has been detected, therefor we must reproduce
7412             // the error that would have been thrown
7413             const msg = this.errorMessageProvider.buildMismatchTokenMessage({
7414                 expected: expectedTokType,
7415                 actual: nextTokenWithoutResync,
7416                 previous: previousToken,
7417                 ruleName: this.getCurrRuleFullName(),
7418             });
7419             const error = new MismatchedTokenException(msg, nextTokenWithoutResync, this.LA(0));
7420             // the first token here will be the original cause of the error, this is not part of the resyncedTokens property.
7421             error.resyncedTokens = lodash_es_dropRight(resyncedTokens);
7422             this.SAVE_ERROR(error);
7423         };
7424         while (!passedResyncPoint) {
7425             // re-synced to a point where we can safely exit the repetition/
7426             if (this.tokenMatcher(currToken, expectedTokType)) {
7427                 generateErrorMessage();
7428                 return; // must return here to avoid reverting the inputIdx
7429             }
7430             else if (lookAheadFunc.call(this)) {
7431                 // we skipped enough tokens so we can resync right back into another iteration of the repetition grammar rule
7432                 generateErrorMessage();
7433                 // recursive invocation in other to support multiple re-syncs in the same top level repetition grammar rule
7434                 grammarRule.apply(this, grammarRuleArgs);
7435                 return; // must return here to avoid reverting the inputIdx
7436             }
7437             else if (this.tokenMatcher(currToken, reSyncTokType)) {
7438                 passedResyncPoint = true;
7439             }
7440             else {
7441                 currToken = this.SKIP_TOKEN();
7442                 this.addToResyncTokens(currToken, resyncedTokens);
7443             }
7444         }
7445         // we were unable to find a CLOSER point to resync inside the Repetition, reset the state.
7446         // The parsing exception we were trying to prevent will happen in the NEXT parsing step. it may be handled by
7447         // "between rules" resync recovery later in the flow.
7448         this.importLexerState(savedLexerState);
7449     }
7450     shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck) {
7451         // Edge case of arriving from a MANY repetition which is stuck
7452         // Attempting recovery in this case could cause an infinite loop
7453         if (notStuck === false) {
7454             return false;
7455         }
7456         // no need to recover, next token is what we expect...
7457         if (this.tokenMatcher(this.LA(1), expectTokAfterLastMatch)) {
7458             return false;
7459         }
7460         // error recovery is disabled during backtracking as it can make the parser ignore a valid grammar path
7461         // and prefer some backtracking path that includes recovered errors.
7462         if (this.isBackTracking()) {
7463             return false;
7464         }
7465         // if we can perform inRule recovery (single token insertion or deletion) we always prefer that recovery algorithm
7466         // because if it works, it makes the least amount of changes to the input stream (greedy algorithm)
7467         //noinspection RedundantIfStatementJS
7468         if (this.canPerformInRuleRecovery(expectTokAfterLastMatch, this.getFollowsForInRuleRecovery(expectTokAfterLastMatch, nextTokIdx))) {
7469             return false;
7470         }
7471         return true;
7472     }
7473     // Error Recovery functionality
7474     getFollowsForInRuleRecovery(tokType, tokIdxInRule) {
7475         const grammarPath = this.getCurrentGrammarPath(tokType, tokIdxInRule);
7476         const follows = this.getNextPossibleTokenTypes(grammarPath);
7477         return follows;
7478     }
7479     tryInRuleRecovery(expectedTokType, follows) {
7480         if (this.canRecoverWithSingleTokenInsertion(expectedTokType, follows)) {
7481             const tokToInsert = this.getTokenToInsert(expectedTokType);
7482             return tokToInsert;
7483         }
7484         if (this.canRecoverWithSingleTokenDeletion(expectedTokType)) {
7485             const nextTok = this.SKIP_TOKEN();
7486             this.consumeToken();
7487             return nextTok;
7488         }
7489         throw new InRuleRecoveryException("sad sad panda");
7490     }
7491     canPerformInRuleRecovery(expectedToken, follows) {
7492         return (this.canRecoverWithSingleTokenInsertion(expectedToken, follows) ||
7493             this.canRecoverWithSingleTokenDeletion(expectedToken));
7494     }
7495     canRecoverWithSingleTokenInsertion(expectedTokType, follows) {
7496         if (!this.canTokenTypeBeInsertedInRecovery(expectedTokType)) {
7497             return false;
7498         }
7499         // must know the possible following tokens to perform single token insertion
7500         if ((0,isEmpty/* default */.Z)(follows)) {
7501             return false;
7502         }
7503         const mismatchedTok = this.LA(1);
7504         const isMisMatchedTokInFollows = (0,find/* default */.Z)(follows, (possibleFollowsTokType) => {
7505             return this.tokenMatcher(mismatchedTok, possibleFollowsTokType);
7506         }) !== undefined;
7507         return isMisMatchedTokInFollows;
7508     }
7509     canRecoverWithSingleTokenDeletion(expectedTokType) {
7510         if (!this.canTokenTypeBeDeletedInRecovery(expectedTokType)) {
7511             return false;
7512         }
7513         const isNextTokenWhatIsExpected = this.tokenMatcher(this.LA(2), expectedTokType);
7514         return isNextTokenWhatIsExpected;
7515     }
7516     isInCurrentRuleReSyncSet(tokenTypeIdx) {
7517         const followKey = this.getCurrFollowKey();
7518         const currentRuleReSyncSet = this.getFollowSetFromFollowKey(followKey);
7519         return lodash_es_includes(currentRuleReSyncSet, tokenTypeIdx);
7520     }
7521     findReSyncTokenType() {
7522         const allPossibleReSyncTokTypes = this.flattenFollowSet();
7523         // this loop will always terminate as EOF is always in the follow stack and also always (virtually) in the input
7524         let nextToken = this.LA(1);
7525         let k = 2;
7526         while (true) {
7527             const foundMatch = (0,find/* default */.Z)(allPossibleReSyncTokTypes, (resyncTokType) => {
7528                 const canMatch = tokenMatcher(nextToken, resyncTokType);
7529                 return canMatch;
7530             });
7531             if (foundMatch !== undefined) {
7532                 return foundMatch;
7533             }
7534             nextToken = this.LA(k);
7535             k++;
7536         }
7537     }
7538     getCurrFollowKey() {
7539         // the length is at least one as we always add the ruleName to the stack before invoking the rule.
7540         if (this.RULE_STACK.length === 1) {
7541             return EOF_FOLLOW_KEY;
7542         }
7543         const currRuleShortName = this.getLastExplicitRuleShortName();
7544         const currRuleIdx = this.getLastExplicitRuleOccurrenceIndex();
7545         const prevRuleShortName = this.getPreviousExplicitRuleShortName();
7546         return {
7547             ruleName: this.shortRuleNameToFullName(currRuleShortName),
7548             idxInCallingRule: currRuleIdx,
7549             inRule: this.shortRuleNameToFullName(prevRuleShortName),
7550         };
7551     }
7552     buildFullFollowKeyStack() {
7553         const explicitRuleStack = this.RULE_STACK;
7554         const explicitOccurrenceStack = this.RULE_OCCURRENCE_STACK;
7555         return (0,map/* default */.Z)(explicitRuleStack, (ruleName, idx) => {
7556             if (idx === 0) {
7557                 return EOF_FOLLOW_KEY;
7558             }
7559             return {
7560                 ruleName: this.shortRuleNameToFullName(ruleName),
7561                 idxInCallingRule: explicitOccurrenceStack[idx],
7562                 inRule: this.shortRuleNameToFullName(explicitRuleStack[idx - 1]),
7563             };
7564         });
7565     }
7566     flattenFollowSet() {
7567         const followStack = (0,map/* default */.Z)(this.buildFullFollowKeyStack(), (currKey) => {
7568             return this.getFollowSetFromFollowKey(currKey);
7569         });
7570         return (0,flatten/* default */.Z)(followStack);
7571     }
7572     getFollowSetFromFollowKey(followKey) {
7573         if (followKey === EOF_FOLLOW_KEY) {
7574             return [EOF];
7575         }
7576         const followName = followKey.ruleName + followKey.idxInCallingRule + constants_IN + followKey.inRule;
7577         return this.resyncFollows[followName];
7578     }
7579     // It does not make any sense to include a virtual EOF token in the list of resynced tokens
7580     // as EOF does not really exist and thus does not contain any useful information (line/column numbers)
7581     addToResyncTokens(token, resyncTokens) {
7582         if (!this.tokenMatcher(token, EOF)) {
7583             resyncTokens.push(token);
7584         }
7585         return resyncTokens;
7586     }
7587     reSyncTo(tokType) {
7588         const resyncedTokens = [];
7589         let nextTok = this.LA(1);
7590         while (this.tokenMatcher(nextTok, tokType) === false) {
7591             nextTok = this.SKIP_TOKEN();
7592             this.addToResyncTokens(nextTok, resyncedTokens);
7593         }
7594         // the last token is not part of the error.
7595         return lodash_es_dropRight(resyncedTokens);
7596     }
7597     attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) {
7598         // by default this is a NO-OP
7599         // The actual implementation is with the function(not method) below
7600     }
7601     getCurrentGrammarPath(tokType, tokIdxInRule) {
7602         const pathRuleStack = this.getHumanReadableRuleStack();
7603         const pathOccurrenceStack = (0,lodash_es_clone/* default */.Z)(this.RULE_OCCURRENCE_STACK);
7604         const grammarPath = {
7605             ruleStack: pathRuleStack,
7606             occurrenceStack: pathOccurrenceStack,
7607             lastTok: tokType,
7608             lastTokOccurrence: tokIdxInRule,
7609         };
7610         return grammarPath;
7611     }
7612     getHumanReadableRuleStack() {
7613         return (0,map/* default */.Z)(this.RULE_STACK, (currShortName) => this.shortRuleNameToFullName(currShortName));
7614     }
7615 }
7616 function attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) {
7617     const key = this.getKeyForAutomaticLookahead(dslMethodIdx, prodOccurrence);
7618     let firstAfterRepInfo = this.firstAfterRepMap[key];
7619     if (firstAfterRepInfo === undefined) {
7620         const currRuleName = this.getCurrRuleFullName();
7621         const ruleGrammar = this.getGAstProductions()[currRuleName];
7622         const walker = new nextToksWalker(ruleGrammar, prodOccurrence);
7623         firstAfterRepInfo = walker.startWalking();
7624         this.firstAfterRepMap[key] = firstAfterRepInfo;
7625     }
7626     let expectTokAfterLastMatch = firstAfterRepInfo.token;
7627     let nextTokIdx = firstAfterRepInfo.occurrence;
7628     const isEndOfRule = firstAfterRepInfo.isEndOfRule;
7629     // special edge case of a TOP most repetition after which the input should END.
7630     // this will force an attempt for inRule recovery in that scenario.
7631     if (this.RULE_STACK.length === 1 &&
7632         isEndOfRule &&
7633         expectTokAfterLastMatch === undefined) {
7634         expectTokAfterLastMatch = EOF;
7635         nextTokIdx = 1;
7636     }
7637     // We don't have anything to re-sync to...
7638     // this condition was extracted from `shouldInRepetitionRecoveryBeTried` to act as a type-guard
7639     if (expectTokAfterLastMatch === undefined || nextTokIdx === undefined) {
7640         return;
7641     }
7642     if (this.shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck)) {
7643         // TODO: performance optimization: instead of passing the original args here, we modify
7644         // the args param (or create a new one) and make sure the lookahead func is explicitly provided
7645         // to avoid searching the cache for it once more.
7646         this.tryInRepetitionRecovery(prodFunc, args, lookaheadFunc, expectTokAfterLastMatch);
7647     }
7648 }
7649 //# sourceMappingURL=recoverable.js.map
7650 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/grammar/keys.js
7651 // Lookahead keys are 32Bit integers in the form
7652 // TTTTTTTT-ZZZZZZZZZZZZ-YYYY-XXXXXXXX
7653 // XXXX -> Occurrence Index bitmap.
7654 // YYYY -> DSL Method Type bitmap.
7655 // ZZZZZZZZZZZZZZZ -> Rule short Index bitmap.
7656 // TTTTTTTTT -> alternation alternative index bitmap
7657 const BITS_FOR_METHOD_TYPE = 4;
7658 const BITS_FOR_OCCURRENCE_IDX = 8;
7659 const BITS_FOR_RULE_IDX = 12;
7660 // TODO: validation, this means that there may at most 2^8 --> 256 alternatives for an alternation.
7661 const BITS_FOR_ALT_IDX = 8;
7662 // short string used as part of mapping keys.
7663 // being short improves the performance when composing KEYS for maps out of these
7664 // The 5 - 8 bits (16 possible values, are reserved for the DSL method indices)
7665 const OR_IDX = 1 << BITS_FOR_OCCURRENCE_IDX;
7666 const OPTION_IDX = 2 << BITS_FOR_OCCURRENCE_IDX;
7667 const MANY_IDX = 3 << BITS_FOR_OCCURRENCE_IDX;
7668 const AT_LEAST_ONE_IDX = 4 << BITS_FOR_OCCURRENCE_IDX;
7669 const MANY_SEP_IDX = 5 << BITS_FOR_OCCURRENCE_IDX;
7670 const AT_LEAST_ONE_SEP_IDX = 6 << BITS_FOR_OCCURRENCE_IDX;
7671 // this actually returns a number, but it is always used as a string (object prop key)
7672 function getKeyForAutomaticLookahead(ruleIdx, dslMethodIdx, occurrence) {
7673     return occurrence | dslMethodIdx | ruleIdx;
7674 }
7675 const BITS_START_FOR_ALT_IDX = 32 - BITS_FOR_ALT_IDX;
7676 //# sourceMappingURL=keys.js.map
7677 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js
7678 
7679 
7680 
7681 
7682 
7683 class LLkLookaheadStrategy {
7684     constructor(options) {
7685         var _a;
7686         this.maxLookahead =
7687             (_a = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a !== void 0 ? _a : DEFAULT_PARSER_CONFIG.maxLookahead;
7688     }
7689     validate(options) {
7690         const leftRecursionErrors = this.validateNoLeftRecursion(options.rules);
7691         if ((0,isEmpty/* default */.Z)(leftRecursionErrors)) {
7692             const emptyAltErrors = this.validateEmptyOrAlternatives(options.rules);
7693             const ambiguousAltsErrors = this.validateAmbiguousAlternationAlternatives(options.rules, this.maxLookahead);
7694             const emptyRepetitionErrors = this.validateSomeNonEmptyLookaheadPath(options.rules, this.maxLookahead);
7695             const allErrors = [
7696                 ...leftRecursionErrors,
7697                 ...emptyAltErrors,
7698                 ...ambiguousAltsErrors,
7699                 ...emptyRepetitionErrors,
7700             ];
7701             return allErrors;
7702         }
7703         return leftRecursionErrors;
7704     }
7705     validateNoLeftRecursion(rules) {
7706         return (0,flatMap/* default */.Z)(rules, (currTopRule) => validateNoLeftRecursion(currTopRule, currTopRule, defaultGrammarValidatorErrorProvider));
7707     }
7708     validateEmptyOrAlternatives(rules) {
7709         return (0,flatMap/* default */.Z)(rules, (currTopRule) => validateEmptyOrAlternative(currTopRule, defaultGrammarValidatorErrorProvider));
7710     }
7711     validateAmbiguousAlternationAlternatives(rules, maxLookahead) {
7712         return (0,flatMap/* default */.Z)(rules, (currTopRule) => validateAmbiguousAlternationAlternatives(currTopRule, maxLookahead, defaultGrammarValidatorErrorProvider));
7713     }
7714     validateSomeNonEmptyLookaheadPath(rules, maxLookahead) {
7715         return validateSomeNonEmptyLookaheadPath(rules, maxLookahead, defaultGrammarValidatorErrorProvider);
7716     }
7717     buildLookaheadForAlternation(options) {
7718         return buildLookaheadFuncForOr(options.prodOccurrence, options.rule, options.maxLookahead, options.hasPredicates, options.dynamicTokensEnabled, buildAlternativesLookAheadFunc);
7719     }
7720     buildLookaheadForOptional(options) {
7721         return buildLookaheadFuncForOptionalProd(options.prodOccurrence, options.rule, options.maxLookahead, options.dynamicTokensEnabled, getProdType(options.prodType), buildSingleAlternativeLookaheadFunction);
7722     }
7723 }
7724 //# sourceMappingURL=llk_lookahead.js.map
7725 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js
7726 
7727 
7728 
7729 
7730 
7731 /**
7732  * Trait responsible for the lookahead related utilities and optimizations.
7733  */
7734 class LooksAhead {
7735     initLooksAhead(config) {
7736         this.dynamicTokensEnabled = (0,has/* default */.Z)(config, "dynamicTokensEnabled")
7737             ? config.dynamicTokensEnabled // assumes end user provides the correct config value/type
7738             : DEFAULT_PARSER_CONFIG.dynamicTokensEnabled;
7739         this.maxLookahead = (0,has/* default */.Z)(config, "maxLookahead")
7740             ? config.maxLookahead // assumes end user provides the correct config value/type
7741             : DEFAULT_PARSER_CONFIG.maxLookahead;
7742         this.lookaheadStrategy = (0,has/* default */.Z)(config, "lookaheadStrategy")
7743             ? config.lookaheadStrategy // assumes end user provides the correct config value/type
7744             : new LLkLookaheadStrategy({ maxLookahead: this.maxLookahead });
7745         this.lookAheadFuncsCache = new Map();
7746     }
7747     preComputeLookaheadFunctions(rules) {
7748         (0,forEach/* default */.Z)(rules, (currRule) => {
7749             this.TRACE_INIT(`${currRule.name} Rule Lookahead`, () => {
7750                 const { alternation, repetition, option, repetitionMandatory, repetitionMandatoryWithSeparator, repetitionWithSeparator, } = collectMethods(currRule);
7751                 (0,forEach/* default */.Z)(alternation, (currProd) => {
7752                     const prodIdx = currProd.idx === 0 ? "" : currProd.idx;
7753                     this.TRACE_INIT(`${getProductionDslName(currProd)}${prodIdx}`, () => {
7754                         const laFunc = this.lookaheadStrategy.buildLookaheadForAlternation({
7755                             prodOccurrence: currProd.idx,
7756                             rule: currRule,
7757                             maxLookahead: currProd.maxLookahead || this.maxLookahead,
7758                             hasPredicates: currProd.hasPredicates,
7759                             dynamicTokensEnabled: this.dynamicTokensEnabled,
7760                         });
7761                         const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[currRule.name], OR_IDX, currProd.idx);
7762                         this.setLaFuncCache(key, laFunc);
7763                     });
7764                 });
7765                 (0,forEach/* default */.Z)(repetition, (currProd) => {
7766                     this.computeLookaheadFunc(currRule, currProd.idx, MANY_IDX, "Repetition", currProd.maxLookahead, getProductionDslName(currProd));
7767                 });
7768                 (0,forEach/* default */.Z)(option, (currProd) => {
7769                     this.computeLookaheadFunc(currRule, currProd.idx, OPTION_IDX, "Option", currProd.maxLookahead, getProductionDslName(currProd));
7770                 });
7771                 (0,forEach/* default */.Z)(repetitionMandatory, (currProd) => {
7772                     this.computeLookaheadFunc(currRule, currProd.idx, AT_LEAST_ONE_IDX, "RepetitionMandatory", currProd.maxLookahead, getProductionDslName(currProd));
7773                 });
7774                 (0,forEach/* default */.Z)(repetitionMandatoryWithSeparator, (currProd) => {
7775                     this.computeLookaheadFunc(currRule, currProd.idx, AT_LEAST_ONE_SEP_IDX, "RepetitionMandatoryWithSeparator", currProd.maxLookahead, getProductionDslName(currProd));
7776                 });
7777                 (0,forEach/* default */.Z)(repetitionWithSeparator, (currProd) => {
7778                     this.computeLookaheadFunc(currRule, currProd.idx, MANY_SEP_IDX, "RepetitionWithSeparator", currProd.maxLookahead, getProductionDslName(currProd));
7779                 });
7780             });
7781         });
7782     }
7783     computeLookaheadFunc(rule, prodOccurrence, prodKey, prodType, prodMaxLookahead, dslMethodName) {
7784         this.TRACE_INIT(`${dslMethodName}${prodOccurrence === 0 ? "" : prodOccurrence}`, () => {
7785             const laFunc = this.lookaheadStrategy.buildLookaheadForOptional({
7786                 prodOccurrence,
7787                 rule,
7788                 maxLookahead: prodMaxLookahead || this.maxLookahead,
7789                 dynamicTokensEnabled: this.dynamicTokensEnabled,
7790                 prodType,
7791             });
7792             const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[rule.name], prodKey, prodOccurrence);
7793             this.setLaFuncCache(key, laFunc);
7794         });
7795     }
7796     // this actually returns a number, but it is always used as a string (object prop key)
7797     getKeyForAutomaticLookahead(dslMethodIdx, occurrence) {
7798         const currRuleShortName = this.getLastExplicitRuleShortName();
7799         return getKeyForAutomaticLookahead(currRuleShortName, dslMethodIdx, occurrence);
7800     }
7801     getLaFuncFromCache(key) {
7802         return this.lookAheadFuncsCache.get(key);
7803     }
7804     /* istanbul ignore next */
7805     setLaFuncCache(key, value) {
7806         this.lookAheadFuncsCache.set(key, value);
7807     }
7808 }
7809 class DslMethodsCollectorVisitor extends GAstVisitor {
7810     constructor() {
7811         super(...arguments);
7812         this.dslMethods = {
7813             option: [],
7814             alternation: [],
7815             repetition: [],
7816             repetitionWithSeparator: [],
7817             repetitionMandatory: [],
7818             repetitionMandatoryWithSeparator: [],
7819         };
7820     }
7821     reset() {
7822         this.dslMethods = {
7823             option: [],
7824             alternation: [],
7825             repetition: [],
7826             repetitionWithSeparator: [],
7827             repetitionMandatory: [],
7828             repetitionMandatoryWithSeparator: [],
7829         };
7830     }
7831     visitOption(option) {
7832         this.dslMethods.option.push(option);
7833     }
7834     visitRepetitionWithSeparator(manySep) {
7835         this.dslMethods.repetitionWithSeparator.push(manySep);
7836     }
7837     visitRepetitionMandatory(atLeastOne) {
7838         this.dslMethods.repetitionMandatory.push(atLeastOne);
7839     }
7840     visitRepetitionMandatoryWithSeparator(atLeastOneSep) {
7841         this.dslMethods.repetitionMandatoryWithSeparator.push(atLeastOneSep);
7842     }
7843     visitRepetition(many) {
7844         this.dslMethods.repetition.push(many);
7845     }
7846     visitAlternation(or) {
7847         this.dslMethods.alternation.push(or);
7848     }
7849 }
7850 const collectorVisitor = new DslMethodsCollectorVisitor();
7851 function collectMethods(rule) {
7852     collectorVisitor.reset();
7853     rule.accept(collectorVisitor);
7854     const dslMethods = collectorVisitor.dslMethods;
7855     // avoid uncleaned references
7856     collectorVisitor.reset();
7857     return dslMethods;
7858 }
7859 //# sourceMappingURL=looksahead.js.map
7860 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/cst/cst.js
7861 /**
7862  * This nodeLocation tracking is not efficient and should only be used
7863  * when error recovery is enabled or the Token Vector contains virtual Tokens
7864  * (e.g, Python Indent/Outdent)
7865  * As it executes the calculation for every single terminal/nonTerminal
7866  * and does not rely on the fact the token vector is **sorted**
7867  */
7868 function setNodeLocationOnlyOffset(currNodeLocation, newLocationInfo) {
7869     // First (valid) update for this cst node
7870     if (isNaN(currNodeLocation.startOffset) === true) {
7871         // assumption1: Token location information is either NaN or a valid number
7872         // assumption2: Token location information is fully valid if it exist
7873         // (both start/end offsets exist and are numbers).
7874         currNodeLocation.startOffset = newLocationInfo.startOffset;
7875         currNodeLocation.endOffset = newLocationInfo.endOffset;
7876     }
7877     // Once the startOffset has been updated with a valid number it should never receive
7878     // any farther updates as the Token vector is sorted.
7879     // We still have to check this this condition for every new possible location info
7880     // because with error recovery enabled we may encounter invalid tokens (NaN location props)
7881     else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) {
7882         currNodeLocation.endOffset = newLocationInfo.endOffset;
7883     }
7884 }
7885 /**
7886  * This nodeLocation tracking is not efficient and should only be used
7887  * when error recovery is enabled or the Token Vector contains virtual Tokens
7888  * (e.g, Python Indent/Outdent)
7889  * As it executes the calculation for every single terminal/nonTerminal
7890  * and does not rely on the fact the token vector is **sorted**
7891  */
7892 function setNodeLocationFull(currNodeLocation, newLocationInfo) {
7893     // First (valid) update for this cst node
7894     if (isNaN(currNodeLocation.startOffset) === true) {
7895         // assumption1: Token location information is either NaN or a valid number
7896         // assumption2: Token location information is fully valid if it exist
7897         // (all start/end props exist and are numbers).
7898         currNodeLocation.startOffset = newLocationInfo.startOffset;
7899         currNodeLocation.startColumn = newLocationInfo.startColumn;
7900         currNodeLocation.startLine = newLocationInfo.startLine;
7901         currNodeLocation.endOffset = newLocationInfo.endOffset;
7902         currNodeLocation.endColumn = newLocationInfo.endColumn;
7903         currNodeLocation.endLine = newLocationInfo.endLine;
7904     }
7905     // Once the start props has been updated with a valid number it should never receive
7906     // any farther updates as the Token vector is sorted.
7907     // We still have to check this this condition for every new possible location info
7908     // because with error recovery enabled we may encounter invalid tokens (NaN location props)
7909     else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) {
7910         currNodeLocation.endOffset = newLocationInfo.endOffset;
7911         currNodeLocation.endColumn = newLocationInfo.endColumn;
7912         currNodeLocation.endLine = newLocationInfo.endLine;
7913     }
7914 }
7915 function addTerminalToCst(node, token, tokenTypeName) {
7916     if (node.children[tokenTypeName] === undefined) {
7917         node.children[tokenTypeName] = [token];
7918     }
7919     else {
7920         node.children[tokenTypeName].push(token);
7921     }
7922 }
7923 function addNoneTerminalToCst(node, ruleName, ruleResult) {
7924     if (node.children[ruleName] === undefined) {
7925         node.children[ruleName] = [ruleResult];
7926     }
7927     else {
7928         node.children[ruleName].push(ruleResult);
7929     }
7930 }
7931 //# sourceMappingURL=cst.js.map
7932 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/lang/lang_extensions.js
7933 const NAME = "name";
7934 function defineNameProp(obj, nameValue) {
7935     Object.defineProperty(obj, NAME, {
7936         enumerable: false,
7937         configurable: true,
7938         writable: false,
7939         value: nameValue,
7940     });
7941 }
7942 //# sourceMappingURL=lang_extensions.js.map
7943 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js
7944 
7945 
7946 function defaultVisit(ctx, param) {
7947     const childrenNames = (0,keys/* default */.Z)(ctx);
7948     const childrenNamesLength = childrenNames.length;
7949     for (let i = 0; i < childrenNamesLength; i++) {
7950         const currChildName = childrenNames[i];
7951         const currChildArray = ctx[currChildName];
7952         const currChildArrayLength = currChildArray.length;
7953         for (let j = 0; j < currChildArrayLength; j++) {
7954             const currChild = currChildArray[j];
7955             // distinction between Tokens Children and CstNode children
7956             if (currChild.tokenTypeIdx === undefined) {
7957                 this[currChild.name](currChild.children, param);
7958             }
7959         }
7960     }
7961     // defaultVisit does not support generic out param
7962 }
7963 function createBaseSemanticVisitorConstructor(grammarName, ruleNames) {
7964     const derivedConstructor = function () { };
7965     // can be overwritten according to:
7966     // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/
7967     // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname
7968     defineNameProp(derivedConstructor, grammarName + "BaseSemantics");
7969     const semanticProto = {
7970         visit: function (cstNode, param) {
7971             // enables writing more concise visitor methods when CstNode has only a single child
7972             if ((0,isArray/* default */.Z)(cstNode)) {
7973                 // A CST Node's children dictionary can never have empty arrays as values
7974                 // If a key is defined there will be at least one element in the corresponding value array.
7975                 cstNode = cstNode[0];
7976             }
7977             // enables passing optional CstNodes concisely.
7978             if ((0,isUndefined/* default */.Z)(cstNode)) {
7979                 return undefined;
7980             }
7981             return this[cstNode.name](cstNode.children, param);
7982         },
7983         validateVisitor: function () {
7984             const semanticDefinitionErrors = validateVisitor(this, ruleNames);
7985             if (!(0,isEmpty/* default */.Z)(semanticDefinitionErrors)) {
7986                 const errorMessages = (0,map/* default */.Z)(semanticDefinitionErrors, (currDefError) => currDefError.msg);
7987                 throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t` +
7988                     `${errorMessages.join("\n\n").replace(/\n/g, "\n\t")}`);
7989             }
7990         },
7991     };
7992     derivedConstructor.prototype = semanticProto;
7993     derivedConstructor.prototype.constructor = derivedConstructor;
7994     derivedConstructor._RULE_NAMES = ruleNames;
7995     return derivedConstructor;
7996 }
7997 function createBaseVisitorConstructorWithDefaults(grammarName, ruleNames, baseConstructor) {
7998     const derivedConstructor = function () { };
7999     // can be overwritten according to:
8000     // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/
8001     // name?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FFunction%2Fname
8002     defineNameProp(derivedConstructor, grammarName + "BaseSemanticsWithDefaults");
8003     const withDefaultsProto = Object.create(baseConstructor.prototype);
8004     (0,forEach/* default */.Z)(ruleNames, (ruleName) => {
8005         withDefaultsProto[ruleName] = defaultVisit;
8006     });
8007     derivedConstructor.prototype = withDefaultsProto;
8008     derivedConstructor.prototype.constructor = derivedConstructor;
8009     return derivedConstructor;
8010 }
8011 var CstVisitorDefinitionError;
8012 (function (CstVisitorDefinitionError) {
8013     CstVisitorDefinitionError[CstVisitorDefinitionError["REDUNDANT_METHOD"] = 0] = "REDUNDANT_METHOD";
8014     CstVisitorDefinitionError[CstVisitorDefinitionError["MISSING_METHOD"] = 1] = "MISSING_METHOD";
8015 })(CstVisitorDefinitionError || (CstVisitorDefinitionError = {}));
8016 function validateVisitor(visitorInstance, ruleNames) {
8017     const missingErrors = validateMissingCstMethods(visitorInstance, ruleNames);
8018     return missingErrors;
8019 }
8020 function validateMissingCstMethods(visitorInstance, ruleNames) {
8021     const missingRuleNames = (0,filter/* default */.Z)(ruleNames, (currRuleName) => {
8022         return (0,isFunction/* default */.Z)(visitorInstance[currRuleName]) === false;
8023     });
8024     const errors = (0,map/* default */.Z)(missingRuleNames, (currRuleName) => {
8025         return {
8026             msg: `Missing visitor method: <${currRuleName}> on ${(visitorInstance.constructor.name)} CST Visitor.`,
8027             type: CstVisitorDefinitionError.MISSING_METHOD,
8028             methodName: currRuleName,
8029         };
8030     });
8031     return lodash_es_compact(errors);
8032 }
8033 //# sourceMappingURL=cst_visitor.js.map
8034 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js
8035 
8036 
8037 
8038 
8039 /**
8040  * This trait is responsible for the CST building logic.
8041  */
8042 class TreeBuilder {
8043     initTreeBuilder(config) {
8044         this.CST_STACK = [];
8045         // outputCst is no longer exposed/defined in the pubic API
8046         this.outputCst = config.outputCst;
8047         this.nodeLocationTracking = (0,has/* default */.Z)(config, "nodeLocationTracking")
8048             ? config.nodeLocationTracking // assumes end user provides the correct config value/type
8049             : DEFAULT_PARSER_CONFIG.nodeLocationTracking;
8050         if (!this.outputCst) {
8051             this.cstInvocationStateUpdate = noop/* default */.Z;
8052             this.cstFinallyStateUpdate = noop/* default */.Z;
8053             this.cstPostTerminal = noop/* default */.Z;
8054             this.cstPostNonTerminal = noop/* default */.Z;
8055             this.cstPostRule = noop/* default */.Z;
8056         }
8057         else {
8058             if (/full/i.test(this.nodeLocationTracking)) {
8059                 if (this.recoveryEnabled) {
8060                     this.setNodeLocationFromToken = setNodeLocationFull;
8061                     this.setNodeLocationFromNode = setNodeLocationFull;
8062                     this.cstPostRule = noop/* default */.Z;
8063                     this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery;
8064                 }
8065                 else {
8066                     this.setNodeLocationFromToken = noop/* default */.Z;
8067                     this.setNodeLocationFromNode = noop/* default */.Z;
8068                     this.cstPostRule = this.cstPostRuleFull;
8069                     this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular;
8070                 }
8071             }
8072             else if (/onlyOffset/i.test(this.nodeLocationTracking)) {
8073                 if (this.recoveryEnabled) {
8074                     this.setNodeLocationFromToken = setNodeLocationOnlyOffset;
8075                     this.setNodeLocationFromNode = setNodeLocationOnlyOffset;
8076                     this.cstPostRule = noop/* default */.Z;
8077                     this.setInitialNodeLocation =
8078                         this.setInitialNodeLocationOnlyOffsetRecovery;
8079                 }
8080                 else {
8081                     this.setNodeLocationFromToken = noop/* default */.Z;
8082                     this.setNodeLocationFromNode = noop/* default */.Z;
8083                     this.cstPostRule = this.cstPostRuleOnlyOffset;
8084                     this.setInitialNodeLocation =
8085                         this.setInitialNodeLocationOnlyOffsetRegular;
8086                 }
8087             }
8088             else if (/none/i.test(this.nodeLocationTracking)) {
8089                 this.setNodeLocationFromToken = noop/* default */.Z;
8090                 this.setNodeLocationFromNode = noop/* default */.Z;
8091                 this.cstPostRule = noop/* default */.Z;
8092                 this.setInitialNodeLocation = noop/* default */.Z;
8093             }
8094             else {
8095                 throw Error(`Invalid <nodeLocationTracking> config option: "${config.nodeLocationTracking}"`);
8096             }
8097         }
8098     }
8099     setInitialNodeLocationOnlyOffsetRecovery(cstNode) {
8100         cstNode.location = {
8101             startOffset: NaN,
8102             endOffset: NaN,
8103         };
8104     }
8105     setInitialNodeLocationOnlyOffsetRegular(cstNode) {
8106         cstNode.location = {
8107             // without error recovery the starting Location of a new CstNode is guaranteed
8108             // To be the next Token's startOffset (for valid inputs).
8109             // For invalid inputs there won't be any CSTOutput so this potential
8110             // inaccuracy does not matter
8111             startOffset: this.LA(1).startOffset,
8112             endOffset: NaN,
8113         };
8114     }
8115     setInitialNodeLocationFullRecovery(cstNode) {
8116         cstNode.location = {
8117             startOffset: NaN,
8118             startLine: NaN,
8119             startColumn: NaN,
8120             endOffset: NaN,
8121             endLine: NaN,
8122             endColumn: NaN,
8123         };
8124     }
8125     /**
8126        *  @see setInitialNodeLocationOnlyOffsetRegular for explanation why this work
8127   
8128        * @param cstNode
8129        */
8130     setInitialNodeLocationFullRegular(cstNode) {
8131         const nextToken = this.LA(1);
8132         cstNode.location = {
8133             startOffset: nextToken.startOffset,
8134             startLine: nextToken.startLine,
8135             startColumn: nextToken.startColumn,
8136             endOffset: NaN,
8137             endLine: NaN,
8138             endColumn: NaN,
8139         };
8140     }
8141     cstInvocationStateUpdate(fullRuleName) {
8142         const cstNode = {
8143             name: fullRuleName,
8144             children: Object.create(null),
8145         };
8146         this.setInitialNodeLocation(cstNode);
8147         this.CST_STACK.push(cstNode);
8148     }
8149     cstFinallyStateUpdate() {
8150         this.CST_STACK.pop();
8151     }
8152     cstPostRuleFull(ruleCstNode) {
8153         // casts to `required<CstNodeLocation>` are safe because `cstPostRuleFull` should only be invoked when full location is enabled
8154         const prevToken = this.LA(0);
8155         const loc = ruleCstNode.location;
8156         // If this condition is true it means we consumed at least one Token
8157         // In this CstNode.
8158         if (loc.startOffset <= prevToken.startOffset === true) {
8159             loc.endOffset = prevToken.endOffset;
8160             loc.endLine = prevToken.endLine;
8161             loc.endColumn = prevToken.endColumn;
8162         }
8163         // "empty" CstNode edge case
8164         else {
8165             loc.startOffset = NaN;
8166             loc.startLine = NaN;
8167             loc.startColumn = NaN;
8168         }
8169     }
8170     cstPostRuleOnlyOffset(ruleCstNode) {
8171         const prevToken = this.LA(0);
8172         // `location' is not null because `cstPostRuleOnlyOffset` will only be invoked when location tracking is enabled.
8173         const loc = ruleCstNode.location;
8174         // If this condition is true it means we consumed at least one Token
8175         // In this CstNode.
8176         if (loc.startOffset <= prevToken.startOffset === true) {
8177             loc.endOffset = prevToken.endOffset;
8178         }
8179         // "empty" CstNode edge case
8180         else {
8181             loc.startOffset = NaN;
8182         }
8183     }
8184     cstPostTerminal(key, consumedToken) {
8185         const rootCst = this.CST_STACK[this.CST_STACK.length - 1];
8186         addTerminalToCst(rootCst, consumedToken, key);
8187         // This is only used when **both** error recovery and CST Output are enabled.
8188         this.setNodeLocationFromToken(rootCst.location, consumedToken);
8189     }
8190     cstPostNonTerminal(ruleCstResult, ruleName) {
8191         const preCstNode = this.CST_STACK[this.CST_STACK.length - 1];
8192         addNoneTerminalToCst(preCstNode, ruleName, ruleCstResult);
8193         // This is only used when **both** error recovery and CST Output are enabled.
8194         this.setNodeLocationFromNode(preCstNode.location, ruleCstResult.location);
8195     }
8196     getBaseCstVisitorConstructor() {
8197         if ((0,isUndefined/* default */.Z)(this.baseCstVisitorConstructor)) {
8198             const newBaseCstVisitorConstructor = createBaseSemanticVisitorConstructor(this.className, (0,keys/* default */.Z)(this.gastProductionsCache));
8199             this.baseCstVisitorConstructor = newBaseCstVisitorConstructor;
8200             return newBaseCstVisitorConstructor;
8201         }
8202         return this.baseCstVisitorConstructor;
8203     }
8204     getBaseCstVisitorConstructorWithDefaults() {
8205         if ((0,isUndefined/* default */.Z)(this.baseCstVisitorWithDefaultsConstructor)) {
8206             const newConstructor = createBaseVisitorConstructorWithDefaults(this.className, (0,keys/* default */.Z)(this.gastProductionsCache), this.getBaseCstVisitorConstructor());
8207             this.baseCstVisitorWithDefaultsConstructor = newConstructor;
8208             return newConstructor;
8209         }
8210         return this.baseCstVisitorWithDefaultsConstructor;
8211     }
8212     getLastExplicitRuleShortName() {
8213         const ruleStack = this.RULE_STACK;
8214         return ruleStack[ruleStack.length - 1];
8215     }
8216     getPreviousExplicitRuleShortName() {
8217         const ruleStack = this.RULE_STACK;
8218         return ruleStack[ruleStack.length - 2];
8219     }
8220     getLastExplicitRuleOccurrenceIndex() {
8221         const occurrenceStack = this.RULE_OCCURRENCE_STACK;
8222         return occurrenceStack[occurrenceStack.length - 1];
8223     }
8224 }
8225 //# sourceMappingURL=tree_builder.js.map
8226 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js
8227 
8228 /**
8229  * Trait responsible abstracting over the interaction with Lexer output (Token vector).
8230  *
8231  * This could be generalized to support other kinds of lexers, e.g.
8232  * - Just in Time Lexing / Lexer-Less parsing.
8233  * - Streaming Lexer.
8234  */
8235 class LexerAdapter {
8236     initLexerAdapter() {
8237         this.tokVector = [];
8238         this.tokVectorLength = 0;
8239         this.currIdx = -1;
8240     }
8241     set input(newInput) {
8242         // @ts-ignore - `this parameter` not supported in setters/getters
8243         //   - https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters
8244         if (this.selfAnalysisDone !== true) {
8245             throw Error(`Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.`);
8246         }
8247         // @ts-ignore - `this parameter` not supported in setters/getters
8248         //   - https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters
8249         this.reset();
8250         this.tokVector = newInput;
8251         this.tokVectorLength = newInput.length;
8252     }
8253     get input() {
8254         return this.tokVector;
8255     }
8256     // skips a token and returns the next token
8257     SKIP_TOKEN() {
8258         if (this.currIdx <= this.tokVector.length - 2) {
8259             this.consumeToken();
8260             return this.LA(1);
8261         }
8262         else {
8263             return END_OF_FILE;
8264         }
8265     }
8266     // Lexer (accessing Token vector) related methods which can be overridden to implement lazy lexers
8267     // or lexers dependent on parser context.
8268     LA(howMuch) {
8269         const soughtIdx = this.currIdx + howMuch;
8270         if (soughtIdx < 0 || this.tokVectorLength <= soughtIdx) {
8271             return END_OF_FILE;
8272         }
8273         else {
8274             return this.tokVector[soughtIdx];
8275         }
8276     }
8277     consumeToken() {
8278         this.currIdx++;
8279     }
8280     exportLexerState() {
8281         return this.currIdx;
8282     }
8283     importLexerState(newState) {
8284         this.currIdx = newState;
8285     }
8286     resetLexerState() {
8287         this.currIdx = -1;
8288     }
8289     moveToTerminatedState() {
8290         this.currIdx = this.tokVector.length - 1;
8291     }
8292     getLexerPosition() {
8293         return this.exportLexerState();
8294     }
8295 }
8296 //# sourceMappingURL=lexer_adapter.js.map
8297 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js
8298 
8299 
8300 
8301 
8302 
8303 
8304 /**
8305  * This trait is responsible for implementing the public API
8306  * for defining Chevrotain parsers, i.e:
8307  * - CONSUME
8308  * - RULE
8309  * - OPTION
8310  * - ...
8311  */
8312 class RecognizerApi {
8313     ACTION(impl) {
8314         return impl.call(this);
8315     }
8316     consume(idx, tokType, options) {
8317         return this.consumeInternal(tokType, idx, options);
8318     }
8319     subrule(idx, ruleToCall, options) {
8320         return this.subruleInternal(ruleToCall, idx, options);
8321     }
8322     option(idx, actionORMethodDef) {
8323         return this.optionInternal(actionORMethodDef, idx);
8324     }
8325     or(idx, altsOrOpts) {
8326         return this.orInternal(altsOrOpts, idx);
8327     }
8328     many(idx, actionORMethodDef) {
8329         return this.manyInternal(idx, actionORMethodDef);
8330     }
8331     atLeastOne(idx, actionORMethodDef) {
8332         return this.atLeastOneInternal(idx, actionORMethodDef);
8333     }
8334     CONSUME(tokType, options) {
8335         return this.consumeInternal(tokType, 0, options);
8336     }
8337     CONSUME1(tokType, options) {
8338         return this.consumeInternal(tokType, 1, options);
8339     }
8340     CONSUME2(tokType, options) {
8341         return this.consumeInternal(tokType, 2, options);
8342     }
8343     CONSUME3(tokType, options) {
8344         return this.consumeInternal(tokType, 3, options);
8345     }
8346     CONSUME4(tokType, options) {
8347         return this.consumeInternal(tokType, 4, options);
8348     }
8349     CONSUME5(tokType, options) {
8350         return this.consumeInternal(tokType, 5, options);
8351     }
8352     CONSUME6(tokType, options) {
8353         return this.consumeInternal(tokType, 6, options);
8354     }
8355     CONSUME7(tokType, options) {
8356         return this.consumeInternal(tokType, 7, options);
8357     }
8358     CONSUME8(tokType, options) {
8359         return this.consumeInternal(tokType, 8, options);
8360     }
8361     CONSUME9(tokType, options) {
8362         return this.consumeInternal(tokType, 9, options);
8363     }
8364     SUBRULE(ruleToCall, options) {
8365         return this.subruleInternal(ruleToCall, 0, options);
8366     }
8367     SUBRULE1(ruleToCall, options) {
8368         return this.subruleInternal(ruleToCall, 1, options);
8369     }
8370     SUBRULE2(ruleToCall, options) {
8371         return this.subruleInternal(ruleToCall, 2, options);
8372     }
8373     SUBRULE3(ruleToCall, options) {
8374         return this.subruleInternal(ruleToCall, 3, options);
8375     }
8376     SUBRULE4(ruleToCall, options) {
8377         return this.subruleInternal(ruleToCall, 4, options);
8378     }
8379     SUBRULE5(ruleToCall, options) {
8380         return this.subruleInternal(ruleToCall, 5, options);
8381     }
8382     SUBRULE6(ruleToCall, options) {
8383         return this.subruleInternal(ruleToCall, 6, options);
8384     }
8385     SUBRULE7(ruleToCall, options) {
8386         return this.subruleInternal(ruleToCall, 7, options);
8387     }
8388     SUBRULE8(ruleToCall, options) {
8389         return this.subruleInternal(ruleToCall, 8, options);
8390     }
8391     SUBRULE9(ruleToCall, options) {
8392         return this.subruleInternal(ruleToCall, 9, options);
8393     }
8394     OPTION(actionORMethodDef) {
8395         return this.optionInternal(actionORMethodDef, 0);
8396     }
8397     OPTION1(actionORMethodDef) {
8398         return this.optionInternal(actionORMethodDef, 1);
8399     }
8400     OPTION2(actionORMethodDef) {
8401         return this.optionInternal(actionORMethodDef, 2);
8402     }
8403     OPTION3(actionORMethodDef) {
8404         return this.optionInternal(actionORMethodDef, 3);
8405     }
8406     OPTION4(actionORMethodDef) {
8407         return this.optionInternal(actionORMethodDef, 4);
8408     }
8409     OPTION5(actionORMethodDef) {
8410         return this.optionInternal(actionORMethodDef, 5);
8411     }
8412     OPTION6(actionORMethodDef) {
8413         return this.optionInternal(actionORMethodDef, 6);
8414     }
8415     OPTION7(actionORMethodDef) {
8416         return this.optionInternal(actionORMethodDef, 7);
8417     }
8418     OPTION8(actionORMethodDef) {
8419         return this.optionInternal(actionORMethodDef, 8);
8420     }
8421     OPTION9(actionORMethodDef) {
8422         return this.optionInternal(actionORMethodDef, 9);
8423     }
8424     OR(altsOrOpts) {
8425         return this.orInternal(altsOrOpts, 0);
8426     }
8427     OR1(altsOrOpts) {
8428         return this.orInternal(altsOrOpts, 1);
8429     }
8430     OR2(altsOrOpts) {
8431         return this.orInternal(altsOrOpts, 2);
8432     }
8433     OR3(altsOrOpts) {
8434         return this.orInternal(altsOrOpts, 3);
8435     }
8436     OR4(altsOrOpts) {
8437         return this.orInternal(altsOrOpts, 4);
8438     }
8439     OR5(altsOrOpts) {
8440         return this.orInternal(altsOrOpts, 5);
8441     }
8442     OR6(altsOrOpts) {
8443         return this.orInternal(altsOrOpts, 6);
8444     }
8445     OR7(altsOrOpts) {
8446         return this.orInternal(altsOrOpts, 7);
8447     }
8448     OR8(altsOrOpts) {
8449         return this.orInternal(altsOrOpts, 8);
8450     }
8451     OR9(altsOrOpts) {
8452         return this.orInternal(altsOrOpts, 9);
8453     }
8454     MANY(actionORMethodDef) {
8455         this.manyInternal(0, actionORMethodDef);
8456     }
8457     MANY1(actionORMethodDef) {
8458         this.manyInternal(1, actionORMethodDef);
8459     }
8460     MANY2(actionORMethodDef) {
8461         this.manyInternal(2, actionORMethodDef);
8462     }
8463     MANY3(actionORMethodDef) {
8464         this.manyInternal(3, actionORMethodDef);
8465     }
8466     MANY4(actionORMethodDef) {
8467         this.manyInternal(4, actionORMethodDef);
8468     }
8469     MANY5(actionORMethodDef) {
8470         this.manyInternal(5, actionORMethodDef);
8471     }
8472     MANY6(actionORMethodDef) {
8473         this.manyInternal(6, actionORMethodDef);
8474     }
8475     MANY7(actionORMethodDef) {
8476         this.manyInternal(7, actionORMethodDef);
8477     }
8478     MANY8(actionORMethodDef) {
8479         this.manyInternal(8, actionORMethodDef);
8480     }
8481     MANY9(actionORMethodDef) {
8482         this.manyInternal(9, actionORMethodDef);
8483     }
8484     MANY_SEP(options) {
8485         this.manySepFirstInternal(0, options);
8486     }
8487     MANY_SEP1(options) {
8488         this.manySepFirstInternal(1, options);
8489     }
8490     MANY_SEP2(options) {
8491         this.manySepFirstInternal(2, options);
8492     }
8493     MANY_SEP3(options) {
8494         this.manySepFirstInternal(3, options);
8495     }
8496     MANY_SEP4(options) {
8497         this.manySepFirstInternal(4, options);
8498     }
8499     MANY_SEP5(options) {
8500         this.manySepFirstInternal(5, options);
8501     }
8502     MANY_SEP6(options) {
8503         this.manySepFirstInternal(6, options);
8504     }
8505     MANY_SEP7(options) {
8506         this.manySepFirstInternal(7, options);
8507     }
8508     MANY_SEP8(options) {
8509         this.manySepFirstInternal(8, options);
8510     }
8511     MANY_SEP9(options) {
8512         this.manySepFirstInternal(9, options);
8513     }
8514     AT_LEAST_ONE(actionORMethodDef) {
8515         this.atLeastOneInternal(0, actionORMethodDef);
8516     }
8517     AT_LEAST_ONE1(actionORMethodDef) {
8518         return this.atLeastOneInternal(1, actionORMethodDef);
8519     }
8520     AT_LEAST_ONE2(actionORMethodDef) {
8521         this.atLeastOneInternal(2, actionORMethodDef);
8522     }
8523     AT_LEAST_ONE3(actionORMethodDef) {
8524         this.atLeastOneInternal(3, actionORMethodDef);
8525     }
8526     AT_LEAST_ONE4(actionORMethodDef) {
8527         this.atLeastOneInternal(4, actionORMethodDef);
8528     }
8529     AT_LEAST_ONE5(actionORMethodDef) {
8530         this.atLeastOneInternal(5, actionORMethodDef);
8531     }
8532     AT_LEAST_ONE6(actionORMethodDef) {
8533         this.atLeastOneInternal(6, actionORMethodDef);
8534     }
8535     AT_LEAST_ONE7(actionORMethodDef) {
8536         this.atLeastOneInternal(7, actionORMethodDef);
8537     }
8538     AT_LEAST_ONE8(actionORMethodDef) {
8539         this.atLeastOneInternal(8, actionORMethodDef);
8540     }
8541     AT_LEAST_ONE9(actionORMethodDef) {
8542         this.atLeastOneInternal(9, actionORMethodDef);
8543     }
8544     AT_LEAST_ONE_SEP(options) {
8545         this.atLeastOneSepFirstInternal(0, options);
8546     }
8547     AT_LEAST_ONE_SEP1(options) {
8548         this.atLeastOneSepFirstInternal(1, options);
8549     }
8550     AT_LEAST_ONE_SEP2(options) {
8551         this.atLeastOneSepFirstInternal(2, options);
8552     }
8553     AT_LEAST_ONE_SEP3(options) {
8554         this.atLeastOneSepFirstInternal(3, options);
8555     }
8556     AT_LEAST_ONE_SEP4(options) {
8557         this.atLeastOneSepFirstInternal(4, options);
8558     }
8559     AT_LEAST_ONE_SEP5(options) {
8560         this.atLeastOneSepFirstInternal(5, options);
8561     }
8562     AT_LEAST_ONE_SEP6(options) {
8563         this.atLeastOneSepFirstInternal(6, options);
8564     }
8565     AT_LEAST_ONE_SEP7(options) {
8566         this.atLeastOneSepFirstInternal(7, options);
8567     }
8568     AT_LEAST_ONE_SEP8(options) {
8569         this.atLeastOneSepFirstInternal(8, options);
8570     }
8571     AT_LEAST_ONE_SEP9(options) {
8572         this.atLeastOneSepFirstInternal(9, options);
8573     }
8574     RULE(name, implementation, config = DEFAULT_RULE_CONFIG) {
8575         if (lodash_es_includes(this.definedRulesNames, name)) {
8576             const errMsg = defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({
8577                 topLevelRule: name,
8578                 grammarName: this.className,
8579             });
8580             const error = {
8581                 message: errMsg,
8582                 type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME,
8583                 ruleName: name,
8584             };
8585             this.definitionErrors.push(error);
8586         }
8587         this.definedRulesNames.push(name);
8588         const ruleImplementation = this.defineRule(name, implementation, config);
8589         this[name] = ruleImplementation;
8590         return ruleImplementation;
8591     }
8592     OVERRIDE_RULE(name, impl, config = DEFAULT_RULE_CONFIG) {
8593         const ruleErrors = validateRuleIsOverridden(name, this.definedRulesNames, this.className);
8594         this.definitionErrors = this.definitionErrors.concat(ruleErrors);
8595         const ruleImplementation = this.defineRule(name, impl, config);
8596         this[name] = ruleImplementation;
8597         return ruleImplementation;
8598     }
8599     BACKTRACK(grammarRule, args) {
8600         return function () {
8601             // save org state
8602             this.isBackTrackingStack.push(1);
8603             const orgState = this.saveRecogState();
8604             try {
8605                 grammarRule.apply(this, args);
8606                 // if no exception was thrown we have succeed parsing the rule.
8607                 return true;
8608             }
8609             catch (e) {
8610                 if (isRecognitionException(e)) {
8611                     return false;
8612                 }
8613                 else {
8614                     throw e;
8615                 }
8616             }
8617             finally {
8618                 this.reloadRecogState(orgState);
8619                 this.isBackTrackingStack.pop();
8620             }
8621         };
8622     }
8623     // GAST export APIs
8624     getGAstProductions() {
8625         return this.gastProductionsCache;
8626     }
8627     getSerializedGastProductions() {
8628         return serializeGrammar((0,values/* default */.Z)(this.gastProductionsCache));
8629     }
8630 }
8631 //# sourceMappingURL=recognizer_api.js.map
8632 // EXTERNAL MODULE: ../node_modules/lodash-es/isObject.js
8633 var isObject = __webpack_require__(60417);
8634 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js
8635 
8636 
8637 
8638 
8639 
8640 
8641 
8642 
8643 
8644 /**
8645  * This trait is responsible for the runtime parsing engine
8646  * Used by the official API (recognizer_api.ts)
8647  */
8648 class RecognizerEngine {
8649     initRecognizerEngine(tokenVocabulary, config) {
8650         this.className = this.constructor.name;
8651         // TODO: would using an ES6 Map or plain object be faster (CST building scenario)
8652         this.shortRuleNameToFull = {};
8653         this.fullRuleNameToShort = {};
8654         this.ruleShortNameIdx = 256;
8655         this.tokenMatcher = tokenStructuredMatcherNoCategories;
8656         this.subruleIdx = 0;
8657         this.definedRulesNames = [];
8658         this.tokensMap = {};
8659         this.isBackTrackingStack = [];
8660         this.RULE_STACK = [];
8661         this.RULE_OCCURRENCE_STACK = [];
8662         this.gastProductionsCache = {};
8663         if ((0,has/* default */.Z)(config, "serializedGrammar")) {
8664             throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n" +
8665                 "\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n" +
8666                 "\tFor Further details.");
8667         }
8668         if ((0,isArray/* default */.Z)(tokenVocabulary)) {
8669             // This only checks for Token vocabularies provided as arrays.
8670             // That is good enough because the main objective is to detect users of pre-V4.0 APIs
8671             // rather than all edge cases of empty Token vocabularies.
8672             if ((0,isEmpty/* default */.Z)(tokenVocabulary)) {
8673                 throw Error("A Token Vocabulary cannot be empty.\n" +
8674                     "\tNote that the first argument for the parser constructor\n" +
8675                     "\tis no longer a Token vector (since v4.0).");
8676             }
8677             if (typeof tokenVocabulary[0].startOffset === "number") {
8678                 throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n" +
8679                     "\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n" +
8680                     "\tFor Further details.");
8681             }
8682         }
8683         if ((0,isArray/* default */.Z)(tokenVocabulary)) {
8684             this.tokensMap = (0,reduce/* default */.Z)(tokenVocabulary, (acc, tokType) => {
8685                 acc[tokType.name] = tokType;
8686                 return acc;
8687             }, {});
8688         }
8689         else if ((0,has/* default */.Z)(tokenVocabulary, "modes") &&
8690             lodash_es_every((0,flatten/* default */.Z)((0,values/* default */.Z)(tokenVocabulary.modes)), isTokenType)) {
8691             const allTokenTypes = (0,flatten/* default */.Z)((0,values/* default */.Z)(tokenVocabulary.modes));
8692             const uniqueTokens = lodash_es_uniq(allTokenTypes);
8693             this.tokensMap = (0,reduce/* default */.Z)(uniqueTokens, (acc, tokType) => {
8694                 acc[tokType.name] = tokType;
8695                 return acc;
8696             }, {});
8697         }
8698         else if ((0,isObject/* default */.Z)(tokenVocabulary)) {
8699             this.tokensMap = (0,lodash_es_clone/* default */.Z)(tokenVocabulary);
8700         }
8701         else {
8702             throw new Error("<tokensDictionary> argument must be An Array of Token constructors," +
8703                 " A dictionary of Token constructors or an IMultiModeLexerDefinition");
8704         }
8705         // always add EOF to the tokenNames -> constructors map. it is useful to assure all the input has been
8706         // parsed with a clear error message ("expecting EOF but found ...")
8707         this.tokensMap["EOF"] = EOF;
8708         const allTokenTypes = (0,has/* default */.Z)(tokenVocabulary, "modes")
8709             ? (0,flatten/* default */.Z)((0,values/* default */.Z)(tokenVocabulary.modes))
8710             : (0,values/* default */.Z)(tokenVocabulary);
8711         const noTokenCategoriesUsed = lodash_es_every(allTokenTypes, (tokenConstructor) => (0,isEmpty/* default */.Z)(tokenConstructor.categoryMatches));
8712         this.tokenMatcher = noTokenCategoriesUsed
8713             ? tokenStructuredMatcherNoCategories
8714             : tokenStructuredMatcher;
8715         // Because ES2015+ syntax should be supported for creating Token classes
8716         // We cannot assume that the Token classes were created using the "extendToken" utilities
8717         // Therefore we must augment the Token classes both on Lexer initialization and on Parser initialization
8718         augmentTokenTypes((0,values/* default */.Z)(this.tokensMap));
8719     }
8720     defineRule(ruleName, impl, config) {
8721         if (this.selfAnalysisDone) {
8722             throw Error(`Grammar rule <${ruleName}> may not be defined after the 'performSelfAnalysis' method has been called'\n` +
8723                 `Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);
8724         }
8725         const resyncEnabled = (0,has/* default */.Z)(config, "resyncEnabled")
8726             ? config.resyncEnabled // assumes end user provides the correct config value/type
8727             : DEFAULT_RULE_CONFIG.resyncEnabled;
8728         const recoveryValueFunc = (0,has/* default */.Z)(config, "recoveryValueFunc")
8729             ? config.recoveryValueFunc // assumes end user provides the correct config value/type
8730             : DEFAULT_RULE_CONFIG.recoveryValueFunc;
8731         // performance optimization: Use small integers as keys for the longer human readable "full" rule names.
8732         // this greatly improves Map access time (as much as 8% for some performance benchmarks).
8733         const shortName = this.ruleShortNameIdx << (BITS_FOR_METHOD_TYPE + BITS_FOR_OCCURRENCE_IDX);
8734         this.ruleShortNameIdx++;
8735         this.shortRuleNameToFull[shortName] = ruleName;
8736         this.fullRuleNameToShort[ruleName] = shortName;
8737         let invokeRuleWithTry;
8738         // Micro optimization, only check the condition **once** on rule definition
8739         // instead of **every single** rule invocation.
8740         if (this.outputCst === true) {
8741             invokeRuleWithTry = function invokeRuleWithTry(...args) {
8742                 try {
8743                     this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx);
8744                     impl.apply(this, args);
8745                     const cst = this.CST_STACK[this.CST_STACK.length - 1];
8746                     this.cstPostRule(cst);
8747                     return cst;
8748                 }
8749                 catch (e) {
8750                     return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc);
8751                 }
8752                 finally {
8753                     this.ruleFinallyStateUpdate();
8754                 }
8755             };
8756         }
8757         else {
8758             invokeRuleWithTry = function invokeRuleWithTryCst(...args) {
8759                 try {
8760                     this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx);
8761                     return impl.apply(this, args);
8762                 }
8763                 catch (e) {
8764                     return this.invokeRuleCatch(e, resyncEnabled, recoveryValueFunc);
8765                 }
8766                 finally {
8767                     this.ruleFinallyStateUpdate();
8768                 }
8769             };
8770         }
8771         const wrappedGrammarRule = Object.assign(invokeRuleWithTry, { ruleName, originalGrammarAction: impl });
8772         return wrappedGrammarRule;
8773     }
8774     invokeRuleCatch(e, resyncEnabledConfig, recoveryValueFunc) {
8775         const isFirstInvokedRule = this.RULE_STACK.length === 1;
8776         // note the reSync is always enabled for the first rule invocation, because we must always be able to
8777         // reSync with EOF and just output some INVALID ParseTree
8778         // during backtracking reSync recovery is disabled, otherwise we can't be certain the backtracking
8779         // path is really the most valid one
8780         const reSyncEnabled = resyncEnabledConfig && !this.isBackTracking() && this.recoveryEnabled;
8781         if (isRecognitionException(e)) {
8782             const recogError = e;
8783             if (reSyncEnabled) {
8784                 const reSyncTokType = this.findReSyncTokenType();
8785                 if (this.isInCurrentRuleReSyncSet(reSyncTokType)) {
8786                     recogError.resyncedTokens = this.reSyncTo(reSyncTokType);
8787                     if (this.outputCst) {
8788                         const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1];
8789                         partialCstResult.recoveredNode = true;
8790                         return partialCstResult;
8791                     }
8792                     else {
8793                         return recoveryValueFunc(e);
8794                     }
8795                 }
8796                 else {
8797                     if (this.outputCst) {
8798                         const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1];
8799                         partialCstResult.recoveredNode = true;
8800                         recogError.partialCstResult = partialCstResult;
8801                     }
8802                     // to be handled Further up the call stack
8803                     throw recogError;
8804                 }
8805             }
8806             else if (isFirstInvokedRule) {
8807                 // otherwise a Redundant input error will be created as well and we cannot guarantee that this is indeed the case
8808                 this.moveToTerminatedState();
8809                 // the parser should never throw one of its own errors outside its flow.
8810                 // even if error recovery is disabled
8811                 return recoveryValueFunc(e);
8812             }
8813             else {
8814                 // to be recovered Further up the call stack
8815                 throw recogError;
8816             }
8817         }
8818         else {
8819             // some other Error type which we don't know how to handle (for example a built in JavaScript Error)
8820             throw e;
8821         }
8822     }
8823     // Implementation of parsing DSL
8824     optionInternal(actionORMethodDef, occurrence) {
8825         const key = this.getKeyForAutomaticLookahead(OPTION_IDX, occurrence);
8826         return this.optionInternalLogic(actionORMethodDef, occurrence, key);
8827     }
8828     optionInternalLogic(actionORMethodDef, occurrence, key) {
8829         let lookAheadFunc = this.getLaFuncFromCache(key);
8830         let action;
8831         if (typeof actionORMethodDef !== "function") {
8832             action = actionORMethodDef.DEF;
8833             const predicate = actionORMethodDef.GATE;
8834             // predicate present
8835             if (predicate !== undefined) {
8836                 const orgLookaheadFunction = lookAheadFunc;
8837                 lookAheadFunc = () => {
8838                     return predicate.call(this) && orgLookaheadFunction.call(this);
8839                 };
8840             }
8841         }
8842         else {
8843             action = actionORMethodDef;
8844         }
8845         if (lookAheadFunc.call(this) === true) {
8846             return action.call(this);
8847         }
8848         return undefined;
8849     }
8850     atLeastOneInternal(prodOccurrence, actionORMethodDef) {
8851         const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_IDX, prodOccurrence);
8852         return this.atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, laKey);
8853     }
8854     atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, key) {
8855         let lookAheadFunc = this.getLaFuncFromCache(key);
8856         let action;
8857         if (typeof actionORMethodDef !== "function") {
8858             action = actionORMethodDef.DEF;
8859             const predicate = actionORMethodDef.GATE;
8860             // predicate present
8861             if (predicate !== undefined) {
8862                 const orgLookaheadFunction = lookAheadFunc;
8863                 lookAheadFunc = () => {
8864                     return predicate.call(this) && orgLookaheadFunction.call(this);
8865                 };
8866             }
8867         }
8868         else {
8869             action = actionORMethodDef;
8870         }
8871         if (lookAheadFunc.call(this) === true) {
8872             let notStuck = this.doSingleRepetition(action);
8873             while (lookAheadFunc.call(this) === true &&
8874                 notStuck === true) {
8875                 notStuck = this.doSingleRepetition(action);
8876             }
8877         }
8878         else {
8879             throw this.raiseEarlyExitException(prodOccurrence, PROD_TYPE.REPETITION_MANDATORY, actionORMethodDef.ERR_MSG);
8880         }
8881         // note that while it may seem that this can cause an error because by using a recursive call to
8882         // AT_LEAST_ONE we change the grammar to AT_LEAST_TWO, AT_LEAST_THREE ... , the possible recursive call
8883         // from the tryInRepetitionRecovery(...) will only happen IFF there really are TWO/THREE/.... items.
8884         // Performance optimization: "attemptInRepetitionRecovery" will be defined as NOOP unless recovery is enabled
8885         this.attemptInRepetitionRecovery(this.atLeastOneInternal, [prodOccurrence, actionORMethodDef], lookAheadFunc, AT_LEAST_ONE_IDX, prodOccurrence, NextTerminalAfterAtLeastOneWalker);
8886     }
8887     atLeastOneSepFirstInternal(prodOccurrence, options) {
8888         const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_SEP_IDX, prodOccurrence);
8889         this.atLeastOneSepFirstInternalLogic(prodOccurrence, options, laKey);
8890     }
8891     atLeastOneSepFirstInternalLogic(prodOccurrence, options, key) {
8892         const action = options.DEF;
8893         const separator = options.SEP;
8894         const firstIterationLookaheadFunc = this.getLaFuncFromCache(key);
8895         // 1st iteration
8896         if (firstIterationLookaheadFunc.call(this) === true) {
8897             action.call(this);
8898             //  TODO: Optimization can move this function construction into "attemptInRepetitionRecovery"
8899             //  because it is only needed in error recovery scenarios.
8900             const separatorLookAheadFunc = () => {
8901                 return this.tokenMatcher(this.LA(1), separator);
8902             };
8903             // 2nd..nth iterations
8904             while (this.tokenMatcher(this.LA(1), separator) === true) {
8905                 // note that this CONSUME will never enter recovery because
8906                 // the separatorLookAheadFunc checks that the separator really does exist.
8907                 this.CONSUME(separator);
8908                 // No need for checking infinite loop here due to consuming the separator.
8909                 action.call(this);
8910             }
8911             // Performance optimization: "attemptInRepetitionRecovery" will be defined as NOOP unless recovery is enabled
8912             this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [
8913                 prodOccurrence,
8914                 separator,
8915                 separatorLookAheadFunc,
8916                 action,
8917                 NextTerminalAfterAtLeastOneSepWalker,
8918             ], separatorLookAheadFunc, AT_LEAST_ONE_SEP_IDX, prodOccurrence, NextTerminalAfterAtLeastOneSepWalker);
8919         }
8920         else {
8921             throw this.raiseEarlyExitException(prodOccurrence, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, options.ERR_MSG);
8922         }
8923     }
8924     manyInternal(prodOccurrence, actionORMethodDef) {
8925         const laKey = this.getKeyForAutomaticLookahead(MANY_IDX, prodOccurrence);
8926         return this.manyInternalLogic(prodOccurrence, actionORMethodDef, laKey);
8927     }
8928     manyInternalLogic(prodOccurrence, actionORMethodDef, key) {
8929         let lookaheadFunction = this.getLaFuncFromCache(key);
8930         let action;
8931         if (typeof actionORMethodDef !== "function") {
8932             action = actionORMethodDef.DEF;
8933             const predicate = actionORMethodDef.GATE;
8934             // predicate present
8935             if (predicate !== undefined) {
8936                 const orgLookaheadFunction = lookaheadFunction;
8937                 lookaheadFunction = () => {
8938                     return predicate.call(this) && orgLookaheadFunction.call(this);
8939                 };
8940             }
8941         }
8942         else {
8943             action = actionORMethodDef;
8944         }
8945         let notStuck = true;
8946         while (lookaheadFunction.call(this) === true && notStuck === true) {
8947             notStuck = this.doSingleRepetition(action);
8948         }
8949         // Performance optimization: "attemptInRepetitionRecovery" will be defined as NOOP unless recovery is enabled
8950         this.attemptInRepetitionRecovery(this.manyInternal, [prodOccurrence, actionORMethodDef], lookaheadFunction, MANY_IDX, prodOccurrence, NextTerminalAfterManyWalker, 
8951         // The notStuck parameter is only relevant when "attemptInRepetitionRecovery"
8952         // is invoked from manyInternal, in the MANY_SEP case and AT_LEAST_ONE[_SEP]
8953         // An infinite loop cannot occur as:
8954         // - Either the lookahead is guaranteed to consume something (Single Token Separator)
8955         // - AT_LEAST_ONE by definition is guaranteed to consume something (or error out).
8956         notStuck);
8957     }
8958     manySepFirstInternal(prodOccurrence, options) {
8959         const laKey = this.getKeyForAutomaticLookahead(MANY_SEP_IDX, prodOccurrence);
8960         this.manySepFirstInternalLogic(prodOccurrence, options, laKey);
8961     }
8962     manySepFirstInternalLogic(prodOccurrence, options, key) {
8963         const action = options.DEF;
8964         const separator = options.SEP;
8965         const firstIterationLaFunc = this.getLaFuncFromCache(key);
8966         // 1st iteration
8967         if (firstIterationLaFunc.call(this) === true) {
8968             action.call(this);
8969             const separatorLookAheadFunc = () => {
8970                 return this.tokenMatcher(this.LA(1), separator);
8971             };
8972             // 2nd..nth iterations
8973             while (this.tokenMatcher(this.LA(1), separator) === true) {
8974                 // note that this CONSUME will never enter recovery because
8975                 // the separatorLookAheadFunc checks that the separator really does exist.
8976                 this.CONSUME(separator);
8977                 // No need for checking infinite loop here due to consuming the separator.
8978                 action.call(this);
8979             }
8980             // Performance optimization: "attemptInRepetitionRecovery" will be defined as NOOP unless recovery is enabled
8981             this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [
8982                 prodOccurrence,
8983                 separator,
8984                 separatorLookAheadFunc,
8985                 action,
8986                 NextTerminalAfterManySepWalker,
8987             ], separatorLookAheadFunc, MANY_SEP_IDX, prodOccurrence, NextTerminalAfterManySepWalker);
8988         }
8989     }
8990     repetitionSepSecondInternal(prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker) {
8991         while (separatorLookAheadFunc()) {
8992             // note that this CONSUME will never enter recovery because
8993             // the separatorLookAheadFunc checks that the separator really does exist.
8994             this.CONSUME(separator);
8995             action.call(this);
8996         }
8997         // we can only arrive to this function after an error
8998         // has occurred (hence the name 'second') so the following
8999         // IF will always be entered, its possible to remove it...
9000         // however it is kept to avoid confusion and be consistent.
9001         // Performance optimization: "attemptInRepetitionRecovery" will be defined as NOOP unless recovery is enabled
9002         /* istanbul ignore else */
9003         this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [
9004             prodOccurrence,
9005             separator,
9006             separatorLookAheadFunc,
9007             action,
9008             nextTerminalAfterWalker,
9009         ], separatorLookAheadFunc, AT_LEAST_ONE_SEP_IDX, prodOccurrence, nextTerminalAfterWalker);
9010     }
9011     doSingleRepetition(action) {
9012         const beforeIteration = this.getLexerPosition();
9013         action.call(this);
9014         const afterIteration = this.getLexerPosition();
9015         // This boolean will indicate if this repetition progressed
9016         // or if we are "stuck" (potential infinite loop in the repetition).
9017         return afterIteration > beforeIteration;
9018     }
9019     orInternal(altsOrOpts, occurrence) {
9020         const laKey = this.getKeyForAutomaticLookahead(OR_IDX, occurrence);
9021         const alts = (0,isArray/* default */.Z)(altsOrOpts) ? altsOrOpts : altsOrOpts.DEF;
9022         const laFunc = this.getLaFuncFromCache(laKey);
9023         const altIdxToTake = laFunc.call(this, alts);
9024         if (altIdxToTake !== undefined) {
9025             const chosenAlternative = alts[altIdxToTake];
9026             return chosenAlternative.ALT.call(this);
9027         }
9028         this.raiseNoAltException(occurrence, altsOrOpts.ERR_MSG);
9029     }
9030     ruleFinallyStateUpdate() {
9031         this.RULE_STACK.pop();
9032         this.RULE_OCCURRENCE_STACK.pop();
9033         // NOOP when cst is disabled
9034         this.cstFinallyStateUpdate();
9035         if (this.RULE_STACK.length === 0 && this.isAtEndOfInput() === false) {
9036             const firstRedundantTok = this.LA(1);
9037             const errMsg = this.errorMessageProvider.buildNotAllInputParsedMessage({
9038                 firstRedundant: firstRedundantTok,
9039                 ruleName: this.getCurrRuleFullName(),
9040             });
9041             this.SAVE_ERROR(new NotAllInputParsedException(errMsg, firstRedundantTok));
9042         }
9043     }
9044     subruleInternal(ruleToCall, idx, options) {
9045         let ruleResult;
9046         try {
9047             const args = options !== undefined ? options.ARGS : undefined;
9048             this.subruleIdx = idx;
9049             ruleResult = ruleToCall.apply(this, args);
9050             this.cstPostNonTerminal(ruleResult, options !== undefined && options.LABEL !== undefined
9051                 ? options.LABEL
9052                 : ruleToCall.ruleName);
9053             return ruleResult;
9054         }
9055         catch (e) {
9056             throw this.subruleInternalError(e, options, ruleToCall.ruleName);
9057         }
9058     }
9059     subruleInternalError(e, options, ruleName) {
9060         if (isRecognitionException(e) && e.partialCstResult !== undefined) {
9061             this.cstPostNonTerminal(e.partialCstResult, options !== undefined && options.LABEL !== undefined
9062                 ? options.LABEL
9063                 : ruleName);
9064             delete e.partialCstResult;
9065         }
9066         throw e;
9067     }
9068     consumeInternal(tokType, idx, options) {
9069         let consumedToken;
9070         try {
9071             const nextToken = this.LA(1);
9072             if (this.tokenMatcher(nextToken, tokType) === true) {
9073                 this.consumeToken();
9074                 consumedToken = nextToken;
9075             }
9076             else {
9077                 this.consumeInternalError(tokType, nextToken, options);
9078             }
9079         }
9080         catch (eFromConsumption) {
9081             consumedToken = this.consumeInternalRecovery(tokType, idx, eFromConsumption);
9082         }
9083         this.cstPostTerminal(options !== undefined && options.LABEL !== undefined
9084             ? options.LABEL
9085             : tokType.name, consumedToken);
9086         return consumedToken;
9087     }
9088     consumeInternalError(tokType, nextToken, options) {
9089         let msg;
9090         const previousToken = this.LA(0);
9091         if (options !== undefined && options.ERR_MSG) {
9092             msg = options.ERR_MSG;
9093         }
9094         else {
9095             msg = this.errorMessageProvider.buildMismatchTokenMessage({
9096                 expected: tokType,
9097                 actual: nextToken,
9098                 previous: previousToken,
9099                 ruleName: this.getCurrRuleFullName(),
9100             });
9101         }
9102         throw this.SAVE_ERROR(new MismatchedTokenException(msg, nextToken, previousToken));
9103     }
9104     consumeInternalRecovery(tokType, idx, eFromConsumption) {
9105         // no recovery allowed during backtracking, otherwise backtracking may recover invalid syntax and accept it
9106         // but the original syntax could have been parsed successfully without any backtracking + recovery
9107         if (this.recoveryEnabled &&
9108             // TODO: more robust checking of the exception type. Perhaps Typescript extending expressions?
9109             eFromConsumption.name === "MismatchedTokenException" &&
9110             !this.isBackTracking()) {
9111             const follows = this.getFollowsForInRuleRecovery(tokType, idx);
9112             try {
9113                 return this.tryInRuleRecovery(tokType, follows);
9114             }
9115             catch (eFromInRuleRecovery) {
9116                 if (eFromInRuleRecovery.name === IN_RULE_RECOVERY_EXCEPTION) {
9117                     // failed in RuleRecovery.
9118                     // throw the original error in order to trigger reSync error recovery
9119                     throw eFromConsumption;
9120                 }
9121                 else {
9122                     throw eFromInRuleRecovery;
9123                 }
9124             }
9125         }
9126         else {
9127             throw eFromConsumption;
9128         }
9129     }
9130     saveRecogState() {
9131         // errors is a getter which will clone the errors array
9132         const savedErrors = this.errors;
9133         const savedRuleStack = (0,lodash_es_clone/* default */.Z)(this.RULE_STACK);
9134         return {
9135             errors: savedErrors,
9136             lexerState: this.exportLexerState(),
9137             RULE_STACK: savedRuleStack,
9138             CST_STACK: this.CST_STACK,
9139         };
9140     }
9141     reloadRecogState(newState) {
9142         this.errors = newState.errors;
9143         this.importLexerState(newState.lexerState);
9144         this.RULE_STACK = newState.RULE_STACK;
9145     }
9146     ruleInvocationStateUpdate(shortName, fullName, idxInCallingRule) {
9147         this.RULE_OCCURRENCE_STACK.push(idxInCallingRule);
9148         this.RULE_STACK.push(shortName);
9149         // NOOP when cst is disabled
9150         this.cstInvocationStateUpdate(fullName);
9151     }
9152     isBackTracking() {
9153         return this.isBackTrackingStack.length !== 0;
9154     }
9155     getCurrRuleFullName() {
9156         const shortName = this.getLastExplicitRuleShortName();
9157         return this.shortRuleNameToFull[shortName];
9158     }
9159     shortRuleNameToFullName(shortName) {
9160         return this.shortRuleNameToFull[shortName];
9161     }
9162     isAtEndOfInput() {
9163         return this.tokenMatcher(this.LA(1), EOF);
9164     }
9165     reset() {
9166         this.resetLexerState();
9167         this.subruleIdx = 0;
9168         this.isBackTrackingStack = [];
9169         this.errors = [];
9170         this.RULE_STACK = [];
9171         // TODO: extract a specific reset for TreeBuilder trait
9172         this.CST_STACK = [];
9173         this.RULE_OCCURRENCE_STACK = [];
9174     }
9175 }
9176 //# sourceMappingURL=recognizer_engine.js.map
9177 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js
9178 
9179 
9180 
9181 
9182 /**
9183  * Trait responsible for runtime parsing errors.
9184  */
9185 class ErrorHandler {
9186     initErrorHandler(config) {
9187         this._errors = [];
9188         this.errorMessageProvider = (0,has/* default */.Z)(config, "errorMessageProvider")
9189             ? config.errorMessageProvider // assumes end user provides the correct config value/type
9190             : DEFAULT_PARSER_CONFIG.errorMessageProvider;
9191     }
9192     SAVE_ERROR(error) {
9193         if (isRecognitionException(error)) {
9194             error.context = {
9195                 ruleStack: this.getHumanReadableRuleStack(),
9196                 ruleOccurrenceStack: (0,lodash_es_clone/* default */.Z)(this.RULE_OCCURRENCE_STACK),
9197             };
9198             this._errors.push(error);
9199             return error;
9200         }
9201         else {
9202             throw Error("Trying to save an Error which is not a RecognitionException");
9203         }
9204     }
9205     get errors() {
9206         return (0,lodash_es_clone/* default */.Z)(this._errors);
9207     }
9208     set errors(newErrors) {
9209         this._errors = newErrors;
9210     }
9211     // TODO: consider caching the error message computed information
9212     raiseEarlyExitException(occurrence, prodType, userDefinedErrMsg) {
9213         const ruleName = this.getCurrRuleFullName();
9214         const ruleGrammar = this.getGAstProductions()[ruleName];
9215         const lookAheadPathsPerAlternative = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, this.maxLookahead);
9216         const insideProdPaths = lookAheadPathsPerAlternative[0];
9217         const actualTokens = [];
9218         for (let i = 1; i <= this.maxLookahead; i++) {
9219             actualTokens.push(this.LA(i));
9220         }
9221         const msg = this.errorMessageProvider.buildEarlyExitMessage({
9222             expectedIterationPaths: insideProdPaths,
9223             actual: actualTokens,
9224             previous: this.LA(0),
9225             customUserDescription: userDefinedErrMsg,
9226             ruleName: ruleName,
9227         });
9228         throw this.SAVE_ERROR(new EarlyExitException(msg, this.LA(1), this.LA(0)));
9229     }
9230     // TODO: consider caching the error message computed information
9231     raiseNoAltException(occurrence, errMsgTypes) {
9232         const ruleName = this.getCurrRuleFullName();
9233         const ruleGrammar = this.getGAstProductions()[ruleName];
9234         // TODO: getLookaheadPathsForOr can be slow for large enough maxLookahead and certain grammars, consider caching ?
9235         const lookAheadPathsPerAlternative = getLookaheadPathsForOr(occurrence, ruleGrammar, this.maxLookahead);
9236         const actualTokens = [];
9237         for (let i = 1; i <= this.maxLookahead; i++) {
9238             actualTokens.push(this.LA(i));
9239         }
9240         const previousToken = this.LA(0);
9241         const errMsg = this.errorMessageProvider.buildNoViableAltMessage({
9242             expectedPathsPerAlt: lookAheadPathsPerAlternative,
9243             actual: actualTokens,
9244             previous: previousToken,
9245             customUserDescription: errMsgTypes,
9246             ruleName: this.getCurrRuleFullName(),
9247         });
9248         throw this.SAVE_ERROR(new NoViableAltException(errMsg, this.LA(1), previousToken));
9249     }
9250 }
9251 //# sourceMappingURL=error_handler.js.map
9252 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js
9253 
9254 
9255 class ContentAssist {
9256     initContentAssist() { }
9257     computeContentAssist(startRuleName, precedingInput) {
9258         const startRuleGast = this.gastProductionsCache[startRuleName];
9259         if ((0,isUndefined/* default */.Z)(startRuleGast)) {
9260             throw Error(`Rule ->${startRuleName}<- does not exist in this grammar.`);
9261         }
9262         return nextPossibleTokensAfter([startRuleGast], precedingInput, this.tokenMatcher, this.maxLookahead);
9263     }
9264     // TODO: should this be a member method or a utility? it does not have any state or usage of 'this'...
9265     // TODO: should this be more explicitly part of the public API?
9266     getNextPossibleTokenTypes(grammarPath) {
9267         const topRuleName = lodash_es_head(grammarPath.ruleStack);
9268         const gastProductions = this.getGAstProductions();
9269         const topProduction = gastProductions[topRuleName];
9270         const nextPossibleTokenTypes = new NextAfterTokenWalker(topProduction, grammarPath).startWalking();
9271         return nextPossibleTokenTypes;
9272     }
9273 }
9274 //# sourceMappingURL=context_assist.js.map
9275 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js
9276 
9277 
9278 
9279 
9280 
9281 
9282 
9283 const RECORDING_NULL_OBJECT = {
9284     description: "This Object indicates the Parser is during Recording Phase",
9285 };
9286 Object.freeze(RECORDING_NULL_OBJECT);
9287 const HANDLE_SEPARATOR = true;
9288 const MAX_METHOD_IDX = Math.pow(2, BITS_FOR_OCCURRENCE_IDX) - 1;
9289 const RFT = createToken({ name: "RECORDING_PHASE_TOKEN", pattern: Lexer.NA });
9290 augmentTokenTypes([RFT]);
9291 const RECORDING_PHASE_TOKEN = createTokenInstance(RFT, "This IToken indicates the Parser is in Recording Phase\n\t" +
9292     "" +
9293     "See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details", 
9294 // Using "-1" instead of NaN (as in EOF) because an actual number is less likely to
9295 // cause errors if the output of LA or CONSUME would be (incorrectly) used during the recording phase.
9296 -1, -1, -1, -1, -1, -1);
9297 Object.freeze(RECORDING_PHASE_TOKEN);
9298 const RECORDING_PHASE_CSTNODE = {
9299     name: "This CSTNode indicates the Parser is in Recording Phase\n\t" +
9300         "See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",
9301     children: {},
9302 };
9303 /**
9304  * This trait handles the creation of the GAST structure for Chevrotain Grammars
9305  */
9306 class GastRecorder {
9307     initGastRecorder(config) {
9308         this.recordingProdStack = [];
9309         this.RECORDING_PHASE = false;
9310     }
9311     enableRecording() {
9312         this.RECORDING_PHASE = true;
9313         this.TRACE_INIT("Enable Recording", () => {
9314             /**
9315              * Warning Dark Voodoo Magic upcoming!
9316              * We are "replacing" the public parsing DSL methods API
9317              * With **new** alternative implementations on the Parser **instance**
9318              *
9319              * So far this is the only way I've found to avoid performance regressions during parsing time.
9320              * - Approx 30% performance regression was measured on Chrome 75 Canary when attempting to replace the "internal"
9321              *   implementations directly instead.
9322              */
9323             for (let i = 0; i < 10; i++) {
9324                 const idx = i > 0 ? i : "";
9325                 this[`CONSUME${idx}`] = function (arg1, arg2) {
9326                     return this.consumeInternalRecord(arg1, i, arg2);
9327                 };
9328                 this[`SUBRULE${idx}`] = function (arg1, arg2) {
9329                     return this.subruleInternalRecord(arg1, i, arg2);
9330                 };
9331                 this[`OPTION${idx}`] = function (arg1) {
9332                     return this.optionInternalRecord(arg1, i);
9333                 };
9334                 this[`OR${idx}`] = function (arg1) {
9335                     return this.orInternalRecord(arg1, i);
9336                 };
9337                 this[`MANY${idx}`] = function (arg1) {
9338                     this.manyInternalRecord(i, arg1);
9339                 };
9340                 this[`MANY_SEP${idx}`] = function (arg1) {
9341                     this.manySepFirstInternalRecord(i, arg1);
9342                 };
9343                 this[`AT_LEAST_ONE${idx}`] = function (arg1) {
9344                     this.atLeastOneInternalRecord(i, arg1);
9345                 };
9346                 this[`AT_LEAST_ONE_SEP${idx}`] = function (arg1) {
9347                     this.atLeastOneSepFirstInternalRecord(i, arg1);
9348                 };
9349             }
9350             // DSL methods with the idx(suffix) as an argument
9351             this[`consume`] = function (idx, arg1, arg2) {
9352                 return this.consumeInternalRecord(arg1, idx, arg2);
9353             };
9354             this[`subrule`] = function (idx, arg1, arg2) {
9355                 return this.subruleInternalRecord(arg1, idx, arg2);
9356             };
9357             this[`option`] = function (idx, arg1) {
9358                 return this.optionInternalRecord(arg1, idx);
9359             };
9360             this[`or`] = function (idx, arg1) {
9361                 return this.orInternalRecord(arg1, idx);
9362             };
9363             this[`many`] = function (idx, arg1) {
9364                 this.manyInternalRecord(idx, arg1);
9365             };
9366             this[`atLeastOne`] = function (idx, arg1) {
9367                 this.atLeastOneInternalRecord(idx, arg1);
9368             };
9369             this.ACTION = this.ACTION_RECORD;
9370             this.BACKTRACK = this.BACKTRACK_RECORD;
9371             this.LA = this.LA_RECORD;
9372         });
9373     }
9374     disableRecording() {
9375         this.RECORDING_PHASE = false;
9376         // By deleting these **instance** properties, any future invocation
9377         // will be deferred to the original methods on the **prototype** object
9378         // This seems to get rid of any incorrect optimizations that V8 may
9379         // do during the recording phase.
9380         this.TRACE_INIT("Deleting Recording methods", () => {
9381             const that = this;
9382             for (let i = 0; i < 10; i++) {
9383                 const idx = i > 0 ? i : "";
9384                 delete that[`CONSUME${idx}`];
9385                 delete that[`SUBRULE${idx}`];
9386                 delete that[`OPTION${idx}`];
9387                 delete that[`OR${idx}`];
9388                 delete that[`MANY${idx}`];
9389                 delete that[`MANY_SEP${idx}`];
9390                 delete that[`AT_LEAST_ONE${idx}`];
9391                 delete that[`AT_LEAST_ONE_SEP${idx}`];
9392             }
9393             delete that[`consume`];
9394             delete that[`subrule`];
9395             delete that[`option`];
9396             delete that[`or`];
9397             delete that[`many`];
9398             delete that[`atLeastOne`];
9399             delete that.ACTION;
9400             delete that.BACKTRACK;
9401             delete that.LA;
9402         });
9403     }
9404     //   Parser methods are called inside an ACTION?
9405     //   Maybe try/catch/finally on ACTIONS while disabling the recorders state changes?
9406     // @ts-expect-error -- noop place holder
9407     ACTION_RECORD(impl) {
9408         // NO-OP during recording
9409     }
9410     // Executing backtracking logic will break our recording logic assumptions
9411     BACKTRACK_RECORD(grammarRule, args) {
9412         return () => true;
9413     }
9414     // LA is part of the official API and may be used for custom lookahead logic
9415     // by end users who may forget to wrap it in ACTION or inside a GATE
9416     LA_RECORD(howMuch) {
9417         // We cannot use the RECORD_PHASE_TOKEN here because someone may depend
9418         // On LA return EOF at the end of the input so an infinite loop may occur.
9419         return END_OF_FILE;
9420     }
9421     topLevelRuleRecord(name, def) {
9422         try {
9423             const newTopLevelRule = new Rule({ definition: [], name: name });
9424             newTopLevelRule.name = name;
9425             this.recordingProdStack.push(newTopLevelRule);
9426             def.call(this);
9427             this.recordingProdStack.pop();
9428             return newTopLevelRule;
9429         }
9430         catch (originalError) {
9431             if (originalError.KNOWN_RECORDER_ERROR !== true) {
9432                 try {
9433                     originalError.message =
9434                         originalError.message +
9435                             '\n\t This error was thrown during the "grammar recording phase" For more info see:\n\t' +
9436                             "https://chevrotain.io/docs/guide/internals.html#grammar-recording";
9437                 }
9438                 catch (mutabilityError) {
9439                     // We may not be able to modify the original error object
9440                     throw originalError;
9441                 }
9442             }
9443             throw originalError;
9444         }
9445     }
9446     // Implementation of parsing DSL
9447     optionInternalRecord(actionORMethodDef, occurrence) {
9448         return recordProd.call(this, Option, actionORMethodDef, occurrence);
9449     }
9450     atLeastOneInternalRecord(occurrence, actionORMethodDef) {
9451         recordProd.call(this, RepetitionMandatory, actionORMethodDef, occurrence);
9452     }
9453     atLeastOneSepFirstInternalRecord(occurrence, options) {
9454         recordProd.call(this, RepetitionMandatoryWithSeparator, options, occurrence, HANDLE_SEPARATOR);
9455     }
9456     manyInternalRecord(occurrence, actionORMethodDef) {
9457         recordProd.call(this, Repetition, actionORMethodDef, occurrence);
9458     }
9459     manySepFirstInternalRecord(occurrence, options) {
9460         recordProd.call(this, RepetitionWithSeparator, options, occurrence, HANDLE_SEPARATOR);
9461     }
9462     orInternalRecord(altsOrOpts, occurrence) {
9463         return recordOrProd.call(this, altsOrOpts, occurrence);
9464     }
9465     subruleInternalRecord(ruleToCall, occurrence, options) {
9466         assertMethodIdxIsValid(occurrence);
9467         if (!ruleToCall || (0,has/* default */.Z)(ruleToCall, "ruleName") === false) {
9468             const error = new Error(`<SUBRULE${getIdxSuffix(occurrence)}> argument is invalid` +
9469                 ` expecting a Parser method reference but got: <${JSON.stringify(ruleToCall)}>` +
9470                 `\n inside top level rule: <${this.recordingProdStack[0].name}>`);
9471             error.KNOWN_RECORDER_ERROR = true;
9472             throw error;
9473         }
9474         const prevProd = (0,last/* default */.Z)(this.recordingProdStack);
9475         const ruleName = ruleToCall.ruleName;
9476         const newNoneTerminal = new NonTerminal({
9477             idx: occurrence,
9478             nonTerminalName: ruleName,
9479             label: options === null || options === void 0 ? void 0 : options.LABEL,
9480             // The resolving of the `referencedRule` property will be done once all the Rule's GASTs have been created
9481             referencedRule: undefined,
9482         });
9483         prevProd.definition.push(newNoneTerminal);
9484         return this.outputCst
9485             ? RECORDING_PHASE_CSTNODE
9486             : RECORDING_NULL_OBJECT;
9487     }
9488     consumeInternalRecord(tokType, occurrence, options) {
9489         assertMethodIdxIsValid(occurrence);
9490         if (!hasShortKeyProperty(tokType)) {
9491             const error = new Error(`<CONSUME${getIdxSuffix(occurrence)}> argument is invalid` +
9492                 ` expecting a TokenType reference but got: <${JSON.stringify(tokType)}>` +
9493                 `\n inside top level rule: <${this.recordingProdStack[0].name}>`);
9494             error.KNOWN_RECORDER_ERROR = true;
9495             throw error;
9496         }
9497         const prevProd = (0,last/* default */.Z)(this.recordingProdStack);
9498         const newNoneTerminal = new Terminal({
9499             idx: occurrence,
9500             terminalType: tokType,
9501             label: options === null || options === void 0 ? void 0 : options.LABEL,
9502         });
9503         prevProd.definition.push(newNoneTerminal);
9504         return RECORDING_PHASE_TOKEN;
9505     }
9506 }
9507 function recordProd(prodConstructor, mainProdArg, occurrence, handleSep = false) {
9508     assertMethodIdxIsValid(occurrence);
9509     const prevProd = (0,last/* default */.Z)(this.recordingProdStack);
9510     const grammarAction = (0,isFunction/* default */.Z)(mainProdArg) ? mainProdArg : mainProdArg.DEF;
9511     const newProd = new prodConstructor({ definition: [], idx: occurrence });
9512     if (handleSep) {
9513         newProd.separator = mainProdArg.SEP;
9514     }
9515     if ((0,has/* default */.Z)(mainProdArg, "MAX_LOOKAHEAD")) {
9516         newProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD;
9517     }
9518     this.recordingProdStack.push(newProd);
9519     grammarAction.call(this);
9520     prevProd.definition.push(newProd);
9521     this.recordingProdStack.pop();
9522     return RECORDING_NULL_OBJECT;
9523 }
9524 function recordOrProd(mainProdArg, occurrence) {
9525     assertMethodIdxIsValid(occurrence);
9526     const prevProd = (0,last/* default */.Z)(this.recordingProdStack);
9527     // Only an array of alternatives
9528     const hasOptions = (0,isArray/* default */.Z)(mainProdArg) === false;
9529     const alts = hasOptions === false ? mainProdArg : mainProdArg.DEF;
9530     const newOrProd = new Alternation({
9531         definition: [],
9532         idx: occurrence,
9533         ignoreAmbiguities: hasOptions && mainProdArg.IGNORE_AMBIGUITIES === true,
9534     });
9535     if ((0,has/* default */.Z)(mainProdArg, "MAX_LOOKAHEAD")) {
9536         newOrProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD;
9537     }
9538     const hasPredicates = lodash_es_some(alts, (currAlt) => (0,isFunction/* default */.Z)(currAlt.GATE));
9539     newOrProd.hasPredicates = hasPredicates;
9540     prevProd.definition.push(newOrProd);
9541     (0,forEach/* default */.Z)(alts, (currAlt) => {
9542         const currAltFlat = new Alternative({ definition: [] });
9543         newOrProd.definition.push(currAltFlat);
9544         if ((0,has/* default */.Z)(currAlt, "IGNORE_AMBIGUITIES")) {
9545             currAltFlat.ignoreAmbiguities = currAlt.IGNORE_AMBIGUITIES; // assumes end user provides the correct config value/type
9546         }
9547         // **implicit** ignoreAmbiguities due to usage of gate
9548         else if ((0,has/* default */.Z)(currAlt, "GATE")) {
9549             currAltFlat.ignoreAmbiguities = true;
9550         }
9551         this.recordingProdStack.push(currAltFlat);
9552         currAlt.ALT.call(this);
9553         this.recordingProdStack.pop();
9554     });
9555     return RECORDING_NULL_OBJECT;
9556 }
9557 function getIdxSuffix(idx) {
9558     return idx === 0 ? "" : `${idx}`;
9559 }
9560 function assertMethodIdxIsValid(idx) {
9561     if (idx < 0 || idx > MAX_METHOD_IDX) {
9562         const error = new Error(
9563         // The stack trace will contain all the needed details
9564         `Invalid DSL Method idx value: <${idx}>\n\t` +
9565             `Idx value must be a none negative value smaller than ${MAX_METHOD_IDX + 1}`);
9566         error.KNOWN_RECORDER_ERROR = true;
9567         throw error;
9568     }
9569 }
9570 //# sourceMappingURL=gast_recorder.js.map
9571 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js
9572 
9573 
9574 
9575 /**
9576  * Trait responsible for runtime parsing errors.
9577  */
9578 class PerformanceTracer {
9579     initPerformanceTracer(config) {
9580         if ((0,has/* default */.Z)(config, "traceInitPerf")) {
9581             const userTraceInitPerf = config.traceInitPerf;
9582             const traceIsNumber = typeof userTraceInitPerf === "number";
9583             this.traceInitMaxIdent = traceIsNumber
9584                 ? userTraceInitPerf
9585                 : Infinity;
9586             this.traceInitPerf = traceIsNumber
9587                 ? userTraceInitPerf > 0
9588                 : userTraceInitPerf; // assumes end user provides the correct config value/type
9589         }
9590         else {
9591             this.traceInitMaxIdent = 0;
9592             this.traceInitPerf = DEFAULT_PARSER_CONFIG.traceInitPerf;
9593         }
9594         this.traceInitIndent = -1;
9595     }
9596     TRACE_INIT(phaseDesc, phaseImpl) {
9597         // No need to optimize this using NOOP pattern because
9598         // It is not called in a hot spot...
9599         if (this.traceInitPerf === true) {
9600             this.traceInitIndent++;
9601             const indent = new Array(this.traceInitIndent + 1).join("\t");
9602             if (this.traceInitIndent < this.traceInitMaxIdent) {
9603                 console.log(`${indent}--> <${phaseDesc}>`);
9604             }
9605             const { time, value } = timer(phaseImpl);
9606             /* istanbul ignore next - Difficult to reproduce specific performance behavior (>10ms) in tests */
9607             const traceMethod = time > 10 ? console.warn : console.log;
9608             if (this.traceInitIndent < this.traceInitMaxIdent) {
9609                 traceMethod(`${indent}<-- <${phaseDesc}> time: ${time}ms`);
9610             }
9611             this.traceInitIndent--;
9612             return value;
9613         }
9614         else {
9615             return phaseImpl();
9616         }
9617     }
9618 }
9619 //# sourceMappingURL=perf_tracer.js.map
9620 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/utils/apply_mixins.js
9621 function applyMixins(derivedCtor, baseCtors) {
9622     baseCtors.forEach((baseCtor) => {
9623         const baseProto = baseCtor.prototype;
9624         Object.getOwnPropertyNames(baseProto).forEach((propName) => {
9625             if (propName === "constructor") {
9626                 return;
9627             }
9628             const basePropDescriptor = Object.getOwnPropertyDescriptor(baseProto, propName);
9629             // Handle Accessors
9630             if (basePropDescriptor &&
9631                 (basePropDescriptor.get || basePropDescriptor.set)) {
9632                 Object.defineProperty(derivedCtor.prototype, propName, basePropDescriptor);
9633             }
9634             else {
9635                 derivedCtor.prototype[propName] = baseCtor.prototype[propName];
9636             }
9637         });
9638     });
9639 }
9640 //# sourceMappingURL=apply_mixins.js.map
9641 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/parse/parser/parser.js
9642 
9643 
9644 
9645 
9646 
9647 
9648 
9649 
9650 
9651 
9652 
9653 
9654 
9655 
9656 
9657 
9658 
9659 
9660 const END_OF_FILE = createTokenInstance(EOF, "", NaN, NaN, NaN, NaN, NaN, NaN);
9661 Object.freeze(END_OF_FILE);
9662 const DEFAULT_PARSER_CONFIG = Object.freeze({
9663     recoveryEnabled: false,
9664     maxLookahead: 3,
9665     dynamicTokensEnabled: false,
9666     outputCst: true,
9667     errorMessageProvider: defaultParserErrorProvider,
9668     nodeLocationTracking: "none",
9669     traceInitPerf: false,
9670     skipValidations: false,
9671 });
9672 const DEFAULT_RULE_CONFIG = Object.freeze({
9673     recoveryValueFunc: () => undefined,
9674     resyncEnabled: true,
9675 });
9676 var ParserDefinitionErrorType;
9677 (function (ParserDefinitionErrorType) {
9678     ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_RULE_NAME"] = 0] = "INVALID_RULE_NAME";
9679     ParserDefinitionErrorType[ParserDefinitionErrorType["DUPLICATE_RULE_NAME"] = 1] = "DUPLICATE_RULE_NAME";
9680     ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_RULE_OVERRIDE"] = 2] = "INVALID_RULE_OVERRIDE";
9681     ParserDefinitionErrorType[ParserDefinitionErrorType["DUPLICATE_PRODUCTIONS"] = 3] = "DUPLICATE_PRODUCTIONS";
9682     ParserDefinitionErrorType[ParserDefinitionErrorType["UNRESOLVED_SUBRULE_REF"] = 4] = "UNRESOLVED_SUBRULE_REF";
9683     ParserDefinitionErrorType[ParserDefinitionErrorType["LEFT_RECURSION"] = 5] = "LEFT_RECURSION";
9684     ParserDefinitionErrorType[ParserDefinitionErrorType["NONE_LAST_EMPTY_ALT"] = 6] = "NONE_LAST_EMPTY_ALT";
9685     ParserDefinitionErrorType[ParserDefinitionErrorType["AMBIGUOUS_ALTS"] = 7] = "AMBIGUOUS_ALTS";
9686     ParserDefinitionErrorType[ParserDefinitionErrorType["CONFLICT_TOKENS_RULES_NAMESPACE"] = 8] = "CONFLICT_TOKENS_RULES_NAMESPACE";
9687     ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_TOKEN_NAME"] = 9] = "INVALID_TOKEN_NAME";
9688     ParserDefinitionErrorType[ParserDefinitionErrorType["NO_NON_EMPTY_LOOKAHEAD"] = 10] = "NO_NON_EMPTY_LOOKAHEAD";
9689     ParserDefinitionErrorType[ParserDefinitionErrorType["AMBIGUOUS_PREFIX_ALTS"] = 11] = "AMBIGUOUS_PREFIX_ALTS";
9690     ParserDefinitionErrorType[ParserDefinitionErrorType["TOO_MANY_ALTS"] = 12] = "TOO_MANY_ALTS";
9691     ParserDefinitionErrorType[ParserDefinitionErrorType["CUSTOM_LOOKAHEAD_VALIDATION"] = 13] = "CUSTOM_LOOKAHEAD_VALIDATION";
9692 })(ParserDefinitionErrorType || (ParserDefinitionErrorType = {}));
9693 function EMPTY_ALT(value = undefined) {
9694     return function () {
9695         return value;
9696     };
9697 }
9698 class Parser {
9699     /**
9700      *  @deprecated use the **instance** method with the same name instead
9701      */
9702     static performSelfAnalysis(parserInstance) {
9703         throw Error("The **static** `performSelfAnalysis` method has been deprecated." +
9704             "\t\nUse the **instance** method with the same name instead.");
9705     }
9706     performSelfAnalysis() {
9707         this.TRACE_INIT("performSelfAnalysis", () => {
9708             let defErrorsMsgs;
9709             this.selfAnalysisDone = true;
9710             const className = this.className;
9711             this.TRACE_INIT("toFastProps", () => {
9712                 // Without this voodoo magic the parser would be x3-x4 slower
9713                 // It seems it is better to invoke `toFastProperties` **before**
9714                 // Any manipulations of the `this` object done during the recording phase.
9715                 toFastProperties(this);
9716             });
9717             this.TRACE_INIT("Grammar Recording", () => {
9718                 try {
9719                     this.enableRecording();
9720                     // Building the GAST
9721                     (0,forEach/* default */.Z)(this.definedRulesNames, (currRuleName) => {
9722                         const wrappedRule = this[currRuleName];
9723                         const originalGrammarAction = wrappedRule["originalGrammarAction"];
9724                         let recordedRuleGast;
9725                         this.TRACE_INIT(`${currRuleName} Rule`, () => {
9726                             recordedRuleGast = this.topLevelRuleRecord(currRuleName, originalGrammarAction);
9727                         });
9728                         this.gastProductionsCache[currRuleName] = recordedRuleGast;
9729                     });
9730                 }
9731                 finally {
9732                     this.disableRecording();
9733                 }
9734             });
9735             let resolverErrors = [];
9736             this.TRACE_INIT("Grammar Resolving", () => {
9737                 resolverErrors = gast_resolver_public_resolveGrammar({
9738                     rules: (0,values/* default */.Z)(this.gastProductionsCache),
9739                 });
9740                 this.definitionErrors = this.definitionErrors.concat(resolverErrors);
9741             });
9742             this.TRACE_INIT("Grammar Validations", () => {
9743                 // only perform additional grammar validations IFF no resolving errors have occurred.
9744                 // as unresolved grammar may lead to unhandled runtime exceptions in the follow up validations.
9745                 if ((0,isEmpty/* default */.Z)(resolverErrors) && this.skipValidations === false) {
9746                     const validationErrors = gast_resolver_public_validateGrammar({
9747                         rules: (0,values/* default */.Z)(this.gastProductionsCache),
9748                         tokenTypes: (0,values/* default */.Z)(this.tokensMap),
9749                         errMsgProvider: defaultGrammarValidatorErrorProvider,
9750                         grammarName: className,
9751                     });
9752                     const lookaheadValidationErrors = validateLookahead({
9753                         lookaheadStrategy: this.lookaheadStrategy,
9754                         rules: (0,values/* default */.Z)(this.gastProductionsCache),
9755                         tokenTypes: (0,values/* default */.Z)(this.tokensMap),
9756                         grammarName: className,
9757                     });
9758                     this.definitionErrors = this.definitionErrors.concat(validationErrors, lookaheadValidationErrors);
9759                 }
9760             });
9761             // this analysis may fail if the grammar is not perfectly valid
9762             if ((0,isEmpty/* default */.Z)(this.definitionErrors)) {
9763                 // The results of these computations are not needed unless error recovery is enabled.
9764                 if (this.recoveryEnabled) {
9765                     this.TRACE_INIT("computeAllProdsFollows", () => {
9766                         const allFollows = computeAllProdsFollows((0,values/* default */.Z)(this.gastProductionsCache));
9767                         this.resyncFollows = allFollows;
9768                     });
9769                 }
9770                 this.TRACE_INIT("ComputeLookaheadFunctions", () => {
9771                     var _a, _b;
9772                     (_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, {
9773                         rules: (0,values/* default */.Z)(this.gastProductionsCache),
9774                     });
9775                     this.preComputeLookaheadFunctions((0,values/* default */.Z)(this.gastProductionsCache));
9776                 });
9777             }
9778             if (!Parser.DEFER_DEFINITION_ERRORS_HANDLING &&
9779                 !(0,isEmpty/* default */.Z)(this.definitionErrors)) {
9780                 defErrorsMsgs = (0,map/* default */.Z)(this.definitionErrors, (defError) => defError.message);
9781                 throw new Error(`Parser Definition Errors detected:\n ${defErrorsMsgs.join("\n-------------------------------\n")}`);
9782             }
9783         });
9784     }
9785     constructor(tokenVocabulary, config) {
9786         this.definitionErrors = [];
9787         this.selfAnalysisDone = false;
9788         const that = this;
9789         that.initErrorHandler(config);
9790         that.initLexerAdapter();
9791         that.initLooksAhead(config);
9792         that.initRecognizerEngine(tokenVocabulary, config);
9793         that.initRecoverable(config);
9794         that.initTreeBuilder(config);
9795         that.initContentAssist();
9796         that.initGastRecorder(config);
9797         that.initPerformanceTracer(config);
9798         if ((0,has/* default */.Z)(config, "ignoredIssues")) {
9799             throw new Error("The <ignoredIssues> IParserConfig property has been deprecated.\n\t" +
9800                 "Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n\t" +
9801                 "See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n\t" +
9802                 "For further details.");
9803         }
9804         this.skipValidations = (0,has/* default */.Z)(config, "skipValidations")
9805             ? config.skipValidations // casting assumes the end user passing the correct type
9806             : DEFAULT_PARSER_CONFIG.skipValidations;
9807     }
9808 }
9809 // Set this flag to true if you don't want the Parser to throw error when problems in it's definition are detected.
9810 // (normally during the parser's constructor).
9811 // This is a design time flag, it will not affect the runtime error handling of the parser, just design time errors,
9812 // for example: duplicate rule names, referencing an unresolved subrule, ect...
9813 // This flag should not be enabled during normal usage, it is used in special situations, for example when
9814 // needing to display the parser definition errors in some GUI(online playground).
9815 Parser.DEFER_DEFINITION_ERRORS_HANDLING = false;
9816 applyMixins(Parser, [
9817     Recoverable,
9818     LooksAhead,
9819     TreeBuilder,
9820     LexerAdapter,
9821     RecognizerEngine,
9822     RecognizerApi,
9823     ErrorHandler,
9824     ContentAssist,
9825     GastRecorder,
9826     PerformanceTracer,
9827 ]);
9828 class CstParser extends (/* unused pure expression or super */ null && (Parser)) {
9829     constructor(tokenVocabulary, config = DEFAULT_PARSER_CONFIG) {
9830         const configClone = clone(config);
9831         configClone.outputCst = true;
9832         super(tokenVocabulary, configClone);
9833     }
9834 }
9835 class EmbeddedActionsParser extends Parser {
9836     constructor(tokenVocabulary, config = DEFAULT_PARSER_CONFIG) {
9837         const configClone = (0,lodash_es_clone/* default */.Z)(config);
9838         configClone.outputCst = false;
9839         super(tokenVocabulary, configClone);
9840     }
9841 }
9842 //# sourceMappingURL=parser.js.map
9843 ;// CONCATENATED MODULE: ../node_modules/@chevrotain/cst-dts-gen/lib/src/api.js
9844 
9845 
9846 const defaultOptions = {
9847     includeVisitorInterface: true,
9848     visitorInterfaceName: "ICstNodeVisitor",
9849 };
9850 function generateCstDts(productions, options) {
9851     const effectiveOptions = Object.assign(Object.assign({}, defaultOptions), options);
9852     const model = buildModel(productions);
9853     return genDts(model, effectiveOptions);
9854 }
9855 //# sourceMappingURL=api.js.map
9856 ;// CONCATENATED MODULE: ../node_modules/chevrotain/lib/src/api.js
9857 /* istanbul ignore file - tricky to import some things from this module during testing */
9858 // semantic version
9859 
9860 
9861 
9862 // Tokens utilities
9863 
9864 // Lookahead
9865 
9866 
9867 // Other Utilities
9868 
9869 
9870 
9871 // grammar reflection API
9872 
9873 // GAST Utilities
9874 
9875 
9876 /* istanbul ignore next */
9877 function clearCache() {
9878     console.warn("The clearCache function was 'soft' removed from the Chevrotain API." +
9879         "\n\t It performs no action other than printing this message." +
9880         "\n\t Please avoid using it as it will be completely removed in the future");
9881 }
9882 
9883 class api_Parser {
9884     constructor() {
9885         throw new Error("The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.\t\n" +
9886             "See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0");
9887     }
9888 }
9889 //# sourceMappingURL=api.js.map
9890 
9891 /***/ }),
9892 
9893 /***/ 73001:
9894 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9895 
9896 "use strict";
9897 
9898 // EXPORTS
9899 __webpack_require__.d(__webpack_exports__, {
9900   Q: () => (/* binding */ createDefaultCoreModule),
9901   T: () => (/* binding */ createDefaultSharedCoreModule)
9902 });
9903 
9904 // EXTERNAL MODULE: ../node_modules/langium/lib/utils/cst-utils.js
9905 var cst_utils = __webpack_require__(13871);
9906 // EXTERNAL MODULE: ../node_modules/langium/lib/utils/grammar-utils.js
9907 var grammar_utils = __webpack_require__(30447);
9908 // EXTERNAL MODULE: ../node_modules/langium/lib/utils/regexp-utils.js
9909 var regexp_utils = __webpack_require__(43078);
9910 // EXTERNAL MODULE: ../node_modules/langium/lib/languages/generated/ast.js
9911 var ast = __webpack_require__(34905);
9912 ;// CONCATENATED MODULE: ../node_modules/langium/lib/languages/grammar-config.js
9913 /******************************************************************************
9914  * Copyright 2021 TypeFox GmbH
9915  * This program and the accompanying materials are made available under the
9916  * terms of the MIT License, which is available in the project root.
9917  ******************************************************************************/
9918 
9919 
9920 
9921 
9922 /**
9923  * Create the default grammar configuration (used by `createDefaultModule`). This can be overridden in a
9924  * language-specific module.
9925  */
9926 function createGrammarConfig(services) {
9927     const rules = [];
9928     const grammar = services.Grammar;
9929     for (const rule of grammar.rules) {
9930         if ((0,ast/* isTerminalRule */.MS)(rule) && (0,grammar_utils/* isCommentTerminal */.md)(rule) && (0,regexp_utils/* isMultilineComment */.Rn)((0,grammar_utils/* terminalRegex */.s1)(rule))) {
9931             rules.push(rule.name);
9932         }
9933     }
9934     return {
9935         multilineCommentRules: rules,
9936         nameRegexp: cst_utils/* DefaultNameRegexp */.uz
9937     };
9938 }
9939 //# sourceMappingURL=grammar-config.js.map
9940 // EXTERNAL MODULE: ../node_modules/chevrotain/lib/src/api.js + 67 modules
9941 var api = __webpack_require__(34326);
9942 // EXTERNAL MODULE: ../node_modules/lodash-es/map.js
9943 var map = __webpack_require__(12930);
9944 // EXTERNAL MODULE: ../node_modules/lodash-es/filter.js
9945 var filter = __webpack_require__(11382);
9946 ;// CONCATENATED MODULE: ../node_modules/chevrotain-allstar/lib/atn.js
9947 /******************************************************************************
9948  * Copyright 2022 TypeFox GmbH
9949  * This program and the accompanying materials are made available under the
9950  * terms of the MIT License, which is available in the project root.
9951  ******************************************************************************/
9952 
9953 
9954 
9955 function buildATNKey(rule, type, occurrence) {
9956     return `${rule.name}_${type}_${occurrence}`;
9957 }
9958 const ATN_INVALID_TYPE = 0;
9959 const ATN_BASIC = 1;
9960 const ATN_RULE_START = 2;
9961 const ATN_PLUS_BLOCK_START = 4;
9962 const ATN_STAR_BLOCK_START = 5;
9963 // Currently unused as the ATN is not used for lexing
9964 const ATN_TOKEN_START = 6;
9965 const ATN_RULE_STOP = 7;
9966 const ATN_BLOCK_END = 8;
9967 const ATN_STAR_LOOP_BACK = 9;
9968 const ATN_STAR_LOOP_ENTRY = 10;
9969 const ATN_PLUS_LOOP_BACK = 11;
9970 const ATN_LOOP_END = 12;
9971 class AbstractTransition {
9972     constructor(target) {
9973         this.target = target;
9974     }
9975     isEpsilon() {
9976         return false;
9977     }
9978 }
9979 class AtomTransition extends AbstractTransition {
9980     constructor(target, tokenType) {
9981         super(target);
9982         this.tokenType = tokenType;
9983     }
9984 }
9985 class EpsilonTransition extends AbstractTransition {
9986     constructor(target) {
9987         super(target);
9988     }
9989     isEpsilon() {
9990         return true;
9991     }
9992 }
9993 class RuleTransition extends AbstractTransition {
9994     constructor(ruleStart, rule, followState) {
9995         super(ruleStart);
9996         this.rule = rule;
9997         this.followState = followState;
9998     }
9999     isEpsilon() {
10000         return true;
10001     }
10002 }
10003 function createATN(rules) {
10004     const atn = {
10005         decisionMap: {},
10006         decisionStates: [],
10007         ruleToStartState: new Map(),
10008         ruleToStopState: new Map(),
10009         states: []
10010     };
10011     createRuleStartAndStopATNStates(atn, rules);
10012     const ruleLength = rules.length;
10013     for (let i = 0; i < ruleLength; i++) {
10014         const rule = rules[i];
10015         const ruleBlock = block(atn, rule, rule);
10016         if (ruleBlock === undefined) {
10017             continue;
10018         }
10019         buildRuleHandle(atn, rule, ruleBlock);
10020     }
10021     return atn;
10022 }
10023 function createRuleStartAndStopATNStates(atn, rules) {
10024     const ruleLength = rules.length;
10025     for (let i = 0; i < ruleLength; i++) {
10026         const rule = rules[i];
10027         const start = newState(atn, rule, undefined, {
10028             type: ATN_RULE_START
10029         });
10030         const stop = newState(atn, rule, undefined, {
10031             type: ATN_RULE_STOP
10032         });
10033         start.stop = stop;
10034         atn.ruleToStartState.set(rule, start);
10035         atn.ruleToStopState.set(rule, stop);
10036     }
10037 }
10038 function atom(atn, rule, production) {
10039     if (production instanceof api/* Terminal */.oI) {
10040         return tokenRef(atn, rule, production.terminalType, production);
10041     }
10042     else if (production instanceof api/* NonTerminal */.Sj) {
10043         return ruleRef(atn, rule, production);
10044     }
10045     else if (production instanceof api/* Alternation */.ue) {
10046         return alternation(atn, rule, production);
10047     }
10048     else if (production instanceof api/* Option */.Wx) {
10049         return atn_option(atn, rule, production);
10050     }
10051     else if (production instanceof api/* Repetition */.hI) {
10052         return repetition(atn, rule, production);
10053     }
10054     else if (production instanceof api/* RepetitionWithSeparator */.pT) {
10055         return repetitionSep(atn, rule, production);
10056     }
10057     else if (production instanceof api/* RepetitionMandatory */.ej) {
10058         return repetitionMandatory(atn, rule, production);
10059     }
10060     else if (production instanceof api/* RepetitionMandatoryWithSeparator */.fK) {
10061         return repetitionMandatorySep(atn, rule, production);
10062     }
10063     else {
10064         return block(atn, rule, production);
10065     }
10066 }
10067 function repetition(atn, rule, repetition) {
10068     const starState = newState(atn, rule, repetition, {
10069         type: ATN_STAR_BLOCK_START
10070     });
10071     defineDecisionState(atn, starState);
10072     const handle = makeAlts(atn, rule, starState, repetition, block(atn, rule, repetition));
10073     return star(atn, rule, repetition, handle);
10074 }
10075 function repetitionSep(atn, rule, repetition) {
10076     const starState = newState(atn, rule, repetition, {
10077         type: ATN_STAR_BLOCK_START
10078     });
10079     defineDecisionState(atn, starState);
10080     const handle = makeAlts(atn, rule, starState, repetition, block(atn, rule, repetition));
10081     const sep = tokenRef(atn, rule, repetition.separator, repetition);
10082     return star(atn, rule, repetition, handle, sep);
10083 }
10084 function repetitionMandatory(atn, rule, repetition) {
10085     const plusState = newState(atn, rule, repetition, {
10086         type: ATN_PLUS_BLOCK_START
10087     });
10088     defineDecisionState(atn, plusState);
10089     const handle = makeAlts(atn, rule, plusState, repetition, block(atn, rule, repetition));
10090     return plus(atn, rule, repetition, handle);
10091 }
10092 function repetitionMandatorySep(atn, rule, repetition) {
10093     const plusState = newState(atn, rule, repetition, {
10094         type: ATN_PLUS_BLOCK_START
10095     });
10096     defineDecisionState(atn, plusState);
10097     const handle = makeAlts(atn, rule, plusState, repetition, block(atn, rule, repetition));
10098     const sep = tokenRef(atn, rule, repetition.separator, repetition);
10099     return plus(atn, rule, repetition, handle, sep);
10100 }
10101 function alternation(atn, rule, alternation) {
10102     const start = newState(atn, rule, alternation, {
10103         type: ATN_BASIC
10104     });
10105     defineDecisionState(atn, start);
10106     const alts = (0,map/* default */.Z)(alternation.definition, (e) => atom(atn, rule, e));
10107     const handle = makeAlts(atn, rule, start, alternation, ...alts);
10108     return handle;
10109 }
10110 function atn_option(atn, rule, option) {
10111     const start = newState(atn, rule, option, {
10112         type: ATN_BASIC
10113     });
10114     defineDecisionState(atn, start);
10115     const handle = makeAlts(atn, rule, start, option, block(atn, rule, option));
10116     return optional(atn, rule, option, handle);
10117 }
10118 function block(atn, rule, block) {
10119     const handles = (0,filter/* default */.Z)((0,map/* default */.Z)(block.definition, (e) => atom(atn, rule, e)), (e) => e !== undefined);
10120     if (handles.length === 1) {
10121         return handles[0];
10122     }
10123     else if (handles.length === 0) {
10124         return undefined;
10125     }
10126     else {
10127         return makeBlock(atn, handles);
10128     }
10129 }
10130 function plus(atn, rule, plus, handle, sep) {
10131     const blkStart = handle.left;
10132     const blkEnd = handle.right;
10133     const loop = newState(atn, rule, plus, {
10134         type: ATN_PLUS_LOOP_BACK
10135     });
10136     defineDecisionState(atn, loop);
10137     const end = newState(atn, rule, plus, {
10138         type: ATN_LOOP_END
10139     });
10140     blkStart.loopback = loop;
10141     end.loopback = loop;
10142     atn.decisionMap[buildATNKey(rule, sep ? 'RepetitionMandatoryWithSeparator' : 'RepetitionMandatory', plus.idx)] = loop;
10143     epsilon(blkEnd, loop); // block can see loop back
10144     // Depending on whether we have a separator we put the exit transition at index 1 or 0
10145     // This influences the chosen option in the lookahead DFA
10146     if (sep === undefined) {
10147         epsilon(loop, blkStart); // loop back to start
10148         epsilon(loop, end); // exit
10149     }
10150     else {
10151         epsilon(loop, end); // exit
10152         // loop back to start with separator
10153         epsilon(loop, sep.left);
10154         epsilon(sep.right, blkStart);
10155     }
10156     return {
10157         left: blkStart,
10158         right: end
10159     };
10160 }
10161 function star(atn, rule, star, handle, sep) {
10162     const start = handle.left;
10163     const end = handle.right;
10164     const entry = newState(atn, rule, star, {
10165         type: ATN_STAR_LOOP_ENTRY
10166     });
10167     defineDecisionState(atn, entry);
10168     const loopEnd = newState(atn, rule, star, {
10169         type: ATN_LOOP_END
10170     });
10171     const loop = newState(atn, rule, star, {
10172         type: ATN_STAR_LOOP_BACK
10173     });
10174     entry.loopback = loop;
10175     loopEnd.loopback = loop;
10176     epsilon(entry, start); // loop enter edge (alt 2)
10177     epsilon(entry, loopEnd); // bypass loop edge (alt 1)
10178     epsilon(end, loop); // block end hits loop back
10179     if (sep !== undefined) {
10180         epsilon(loop, loopEnd); // end loop
10181         // loop back to start of handle using separator
10182         epsilon(loop, sep.left);
10183         epsilon(sep.right, start);
10184     }
10185     else {
10186         epsilon(loop, entry); // loop back to entry/exit decision
10187     }
10188     atn.decisionMap[buildATNKey(rule, sep ? 'RepetitionWithSeparator' : 'Repetition', star.idx)] = entry;
10189     return {
10190         left: entry,
10191         right: loopEnd
10192     };
10193 }
10194 function optional(atn, rule, optional, handle) {
10195     const start = handle.left;
10196     const end = handle.right;
10197     epsilon(start, end);
10198     atn.decisionMap[buildATNKey(rule, 'Option', optional.idx)] = start;
10199     return handle;
10200 }
10201 function defineDecisionState(atn, state) {
10202     atn.decisionStates.push(state);
10203     state.decision = atn.decisionStates.length - 1;
10204     return state.decision;
10205 }
10206 function makeAlts(atn, rule, start, production, ...alts) {
10207     const end = newState(atn, rule, production, {
10208         type: ATN_BLOCK_END,
10209         start
10210     });
10211     start.end = end;
10212     for (const alt of alts) {
10213         if (alt !== undefined) {
10214             // hook alts up to decision block
10215             epsilon(start, alt.left);
10216             epsilon(alt.right, end);
10217         }
10218         else {
10219             epsilon(start, end);
10220         }
10221     }
10222     const handle = {
10223         left: start,
10224         right: end
10225     };
10226     atn.decisionMap[buildATNKey(rule, getProdType(production), production.idx)] = start;
10227     return handle;
10228 }
10229 function getProdType(production) {
10230     if (production instanceof api/* Alternation */.ue) {
10231         return 'Alternation';
10232     }
10233     else if (production instanceof api/* Option */.Wx) {
10234         return 'Option';
10235     }
10236     else if (production instanceof api/* Repetition */.hI) {
10237         return 'Repetition';
10238     }
10239     else if (production instanceof api/* RepetitionWithSeparator */.pT) {
10240         return 'RepetitionWithSeparator';
10241     }
10242     else if (production instanceof api/* RepetitionMandatory */.ej) {
10243         return 'RepetitionMandatory';
10244     }
10245     else if (production instanceof api/* RepetitionMandatoryWithSeparator */.fK) {
10246         return 'RepetitionMandatoryWithSeparator';
10247     }
10248     else {
10249         throw new Error('Invalid production type encountered');
10250     }
10251 }
10252 function makeBlock(atn, alts) {
10253     const altsLength = alts.length;
10254     for (let i = 0; i < altsLength - 1; i++) {
10255         const handle = alts[i];
10256         let transition;
10257         if (handle.left.transitions.length === 1) {
10258             transition = handle.left.transitions[0];
10259         }
10260         const isRuleTransition = transition instanceof RuleTransition;
10261         const ruleTransition = transition;
10262         const next = alts[i + 1].left;
10263         if (handle.left.type === ATN_BASIC &&
10264             handle.right.type === ATN_BASIC &&
10265             transition !== undefined &&
10266             ((isRuleTransition && ruleTransition.followState === handle.right) ||
10267                 transition.target === handle.right)) {
10268             // we can avoid epsilon edge to next element
10269             if (isRuleTransition) {
10270                 ruleTransition.followState = next;
10271             }
10272             else {
10273                 transition.target = next;
10274             }
10275             removeState(atn, handle.right); // we skipped over this state
10276         }
10277         else {
10278             // need epsilon if previous block's right end node is complex
10279             epsilon(handle.right, next);
10280         }
10281     }
10282     const first = alts[0];
10283     const last = alts[altsLength - 1];
10284     return {
10285         left: first.left,
10286         right: last.right
10287     };
10288 }
10289 function tokenRef(atn, rule, tokenType, production) {
10290     const left = newState(atn, rule, production, {
10291         type: ATN_BASIC
10292     });
10293     const right = newState(atn, rule, production, {
10294         type: ATN_BASIC
10295     });
10296     addTransition(left, new AtomTransition(right, tokenType));
10297     return {
10298         left,
10299         right
10300     };
10301 }
10302 function ruleRef(atn, currentRule, nonTerminal) {
10303     const rule = nonTerminal.referencedRule;
10304     const start = atn.ruleToStartState.get(rule);
10305     const left = newState(atn, currentRule, nonTerminal, {
10306         type: ATN_BASIC
10307     });
10308     const right = newState(atn, currentRule, nonTerminal, {
10309         type: ATN_BASIC
10310     });
10311     const call = new RuleTransition(start, rule, right);
10312     addTransition(left, call);
10313     return {
10314         left,
10315         right
10316     };
10317 }
10318 function buildRuleHandle(atn, rule, block) {
10319     const start = atn.ruleToStartState.get(rule);
10320     epsilon(start, block.left);
10321     const stop = atn.ruleToStopState.get(rule);
10322     epsilon(block.right, stop);
10323     const handle = {
10324         left: start,
10325         right: stop
10326     };
10327     return handle;
10328 }
10329 function epsilon(a, b) {
10330     const transition = new EpsilonTransition(b);
10331     addTransition(a, transition);
10332 }
10333 function newState(atn, rule, production, partial) {
10334     const t = Object.assign({ atn,
10335         production, epsilonOnlyTransitions: false, rule, transitions: [], nextTokenWithinRule: [], stateNumber: atn.states.length }, partial);
10336     atn.states.push(t);
10337     return t;
10338 }
10339 function addTransition(state, transition) {
10340     // A single ATN state can only contain epsilon transitions or non-epsilon transitions
10341     // Because they are never mixed, only setting the property for the first transition is fine
10342     if (state.transitions.length === 0) {
10343         state.epsilonOnlyTransitions = transition.isEpsilon();
10344     }
10345     state.transitions.push(transition);
10346 }
10347 function removeState(atn, state) {
10348     atn.states.splice(atn.states.indexOf(state), 1);
10349 }
10350 //# sourceMappingURL=atn.js.map
10351 ;// CONCATENATED MODULE: ../node_modules/chevrotain-allstar/lib/dfa.js
10352 /******************************************************************************
10353  * Copyright 2022 TypeFox GmbH
10354  * This program and the accompanying materials are made available under the
10355  * terms of the MIT License, which is available in the project root.
10356  ******************************************************************************/
10357 
10358 const DFA_ERROR = {};
10359 class ATNConfigSet {
10360     constructor() {
10361         this.map = {};
10362         this.configs = [];
10363     }
10364     get size() {
10365         return this.configs.length;
10366     }
10367     finalize() {
10368         // Empties the map to free up memory
10369         this.map = {};
10370     }
10371     add(config) {
10372         const key = getATNConfigKey(config);
10373         // Only add configs which don't exist in our map already
10374         // While this does not influence the actual algorithm, adding them anyway would massively increase memory consumption
10375         if (!(key in this.map)) {
10376             this.map[key] = this.configs.length;
10377             this.configs.push(config);
10378         }
10379     }
10380     get elements() {
10381         return this.configs;
10382     }
10383     get alts() {
10384         return (0,map/* default */.Z)(this.configs, (e) => e.alt);
10385     }
10386     get key() {
10387         let value = "";
10388         for (const k in this.map) {
10389             value += k + ":";
10390         }
10391         return value;
10392     }
10393 }
10394 function getATNConfigKey(config, alt = true) {
10395     return `${alt ? `a${config.alt}` : ""}s${config.state.stateNumber}:${config.stack.map((e) => e.stateNumber.toString()).join("_")}`;
10396 }
10397 //# sourceMappingURL=dfa.js.map
10398 // EXTERNAL MODULE: ../node_modules/lodash-es/min.js
10399 var min = __webpack_require__(18519);
10400 // EXTERNAL MODULE: ../node_modules/lodash-es/flatMap.js
10401 var flatMap = __webpack_require__(34134);
10402 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseIteratee.js + 15 modules
10403 var _baseIteratee = __webpack_require__(86494);
10404 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseUniq.js + 1 modules
10405 var _baseUniq = __webpack_require__(99633);
10406 ;// CONCATENATED MODULE: ../node_modules/lodash-es/uniqBy.js
10407 
10408 
10409 
10410 /**
10411  * This method is like `_.uniq` except that it accepts `iteratee` which is
10412  * invoked for each element in `array` to generate the criterion by which
10413  * uniqueness is computed. The order of result values is determined by the
10414  * order they occur in the array. The iteratee is invoked with one argument:
10415  * (value).
10416  *
10417  * @static
10418  * @memberOf _
10419  * @since 4.0.0
10420  * @category Array
10421  * @param {Array} array The array to inspect.
10422  * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
10423  * @returns {Array} Returns the new duplicate free array.
10424  * @example
10425  *
10426  * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
10427  * // => [2.1, 1.2]
10428  *
10429  * // The `_.property` iteratee shorthand.
10430  * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
10431  * // => [{ 'x': 1 }, { 'x': 2 }]
10432  */
10433 function uniqBy(array, iteratee) {
10434   return (array && array.length) ? (0,_baseUniq/* default */.Z)(array, (0,_baseIteratee/* default */.Z)(iteratee, 2)) : [];
10435 }
10436 
10437 /* harmony default export */ const lodash_es_uniqBy = (uniqBy);
10438 
10439 // EXTERNAL MODULE: ../node_modules/lodash-es/flatten.js
10440 var flatten = __webpack_require__(28099);
10441 // EXTERNAL MODULE: ../node_modules/lodash-es/forEach.js
10442 var forEach = __webpack_require__(21845);
10443 // EXTERNAL MODULE: ../node_modules/lodash-es/isEmpty.js
10444 var isEmpty = __webpack_require__(66400);
10445 // EXTERNAL MODULE: ../node_modules/lodash-es/reduce.js + 2 modules
10446 var reduce = __webpack_require__(99413);
10447 ;// CONCATENATED MODULE: ../node_modules/chevrotain-allstar/lib/all-star-lookahead.js
10448 /******************************************************************************
10449  * Copyright 2022 TypeFox GmbH
10450  * This program and the accompanying materials are made available under the
10451  * terms of the MIT License, which is available in the project root.
10452  ******************************************************************************/
10453 
10454 
10455 
10456 
10457 
10458 
10459 
10460 
10461 
10462 
10463 
10464 function createDFACache(startState, decision) {
10465     const map = {};
10466     return (predicateSet) => {
10467         const key = predicateSet.toString();
10468         let existing = map[key];
10469         if (existing !== undefined) {
10470             return existing;
10471         }
10472         else {
10473             existing = {
10474                 atnStartState: startState,
10475                 decision,
10476                 states: {}
10477             };
10478             map[key] = existing;
10479             return existing;
10480         }
10481     };
10482 }
10483 class PredicateSet {
10484     constructor() {
10485         this.predicates = [];
10486     }
10487     is(index) {
10488         return index >= this.predicates.length || this.predicates[index];
10489     }
10490     set(index, value) {
10491         this.predicates[index] = value;
10492     }
10493     toString() {
10494         let value = "";
10495         const size = this.predicates.length;
10496         for (let i = 0; i < size; i++) {
10497             value += this.predicates[i] === true ? "1" : "0";
10498         }
10499         return value;
10500     }
10501 }
10502 const EMPTY_PREDICATES = new PredicateSet();
10503 class LLStarLookaheadStrategy extends api/* LLkLookaheadStrategy */.dV {
10504     constructor(options) {
10505         var _a;
10506         super();
10507         this.logging = (_a = options === null || options === void 0 ? void 0 : options.logging) !== null && _a !== void 0 ? _a : ((message) => console.log(message));
10508     }
10509     initialize(options) {
10510         this.atn = createATN(options.rules);
10511         this.dfas = initATNSimulator(this.atn);
10512     }
10513     validateAmbiguousAlternationAlternatives() {
10514         return [];
10515     }
10516     validateEmptyOrAlternatives() {
10517         return [];
10518     }
10519     buildLookaheadForAlternation(options) {
10520         const { prodOccurrence, rule, hasPredicates, dynamicTokensEnabled } = options;
10521         const dfas = this.dfas;
10522         const logging = this.logging;
10523         const key = buildATNKey(rule, 'Alternation', prodOccurrence);
10524         const decisionState = this.atn.decisionMap[key];
10525         const decisionIndex = decisionState.decision;
10526         const partialAlts = (0,map/* default */.Z)((0,api/* getLookaheadPaths */.oC)({
10527             maxLookahead: 1,
10528             occurrence: prodOccurrence,
10529             prodType: "Alternation",
10530             rule: rule
10531         }), (currAlt) => (0,map/* default */.Z)(currAlt, (path) => path[0]));
10532         if (isLL1Sequence(partialAlts, false) && !dynamicTokensEnabled) {
10533             const choiceToAlt = (0,reduce/* default */.Z)(partialAlts, (result, currAlt, idx) => {
10534                 (0,forEach/* default */.Z)(currAlt, (currTokType) => {
10535                     if (currTokType) {
10536                         result[currTokType.tokenTypeIdx] = idx;
10537                         (0,forEach/* default */.Z)(currTokType.categoryMatches, (currExtendingType) => {
10538                             result[currExtendingType] = idx;
10539                         });
10540                     }
10541                 });
10542                 return result;
10543             }, {});
10544             if (hasPredicates) {
10545                 return function (orAlts) {
10546                     var _a;
10547                     const nextToken = this.LA(1);
10548                     const prediction = choiceToAlt[nextToken.tokenTypeIdx];
10549                     if (orAlts !== undefined && prediction !== undefined) {
10550                         const gate = (_a = orAlts[prediction]) === null || _a === void 0 ? void 0 : _a.GATE;
10551                         if (gate !== undefined && gate.call(this) === false) {
10552                             return undefined;
10553                         }
10554                     }
10555                     return prediction;
10556                 };
10557             }
10558             else {
10559                 return function () {
10560                     const nextToken = this.LA(1);
10561                     return choiceToAlt[nextToken.tokenTypeIdx];
10562                 };
10563             }
10564         }
10565         else if (hasPredicates) {
10566             return function (orAlts) {
10567                 const predicates = new PredicateSet();
10568                 const length = orAlts === undefined ? 0 : orAlts.length;
10569                 for (let i = 0; i < length; i++) {
10570                     const gate = orAlts === null || orAlts === void 0 ? void 0 : orAlts[i].GATE;
10571                     predicates.set(i, gate === undefined || gate.call(this));
10572                 }
10573                 const result = adaptivePredict.call(this, dfas, decisionIndex, predicates, logging);
10574                 return typeof result === 'number' ? result : undefined;
10575             };
10576         }
10577         else {
10578             return function () {
10579                 const result = adaptivePredict.call(this, dfas, decisionIndex, EMPTY_PREDICATES, logging);
10580                 return typeof result === 'number' ? result : undefined;
10581             };
10582         }
10583     }
10584     buildLookaheadForOptional(options) {
10585         const { prodOccurrence, rule, prodType, dynamicTokensEnabled } = options;
10586         const dfas = this.dfas;
10587         const logging = this.logging;
10588         const key = buildATNKey(rule, prodType, prodOccurrence);
10589         const decisionState = this.atn.decisionMap[key];
10590         const decisionIndex = decisionState.decision;
10591         const alts = (0,map/* default */.Z)((0,api/* getLookaheadPaths */.oC)({
10592             maxLookahead: 1,
10593             occurrence: prodOccurrence,
10594             prodType,
10595             rule
10596         }), (e) => {
10597             return (0,map/* default */.Z)(e, (g) => g[0]);
10598         });
10599         if (isLL1Sequence(alts) && alts[0][0] && !dynamicTokensEnabled) {
10600             const alt = alts[0];
10601             const singleTokensTypes = (0,flatten/* default */.Z)(alt);
10602             if (singleTokensTypes.length === 1 &&
10603                 (0,isEmpty/* default */.Z)(singleTokensTypes[0].categoryMatches)) {
10604                 const expectedTokenType = singleTokensTypes[0];
10605                 const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx;
10606                 return function () {
10607                     return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey;
10608                 };
10609             }
10610             else {
10611                 const choiceToAlt = (0,reduce/* default */.Z)(singleTokensTypes, (result, currTokType) => {
10612                     if (currTokType !== undefined) {
10613                         result[currTokType.tokenTypeIdx] = true;
10614                         (0,forEach/* default */.Z)(currTokType.categoryMatches, (currExtendingType) => {
10615                             result[currExtendingType] = true;
10616                         });
10617                     }
10618                     return result;
10619                 }, {});
10620                 return function () {
10621                     const nextToken = this.LA(1);
10622                     return choiceToAlt[nextToken.tokenTypeIdx] === true;
10623                 };
10624             }
10625         }
10626         return function () {
10627             const result = adaptivePredict.call(this, dfas, decisionIndex, EMPTY_PREDICATES, logging);
10628             return typeof result === "object" ? false : result === 0;
10629         };
10630     }
10631 }
10632 function isLL1Sequence(sequences, allowEmpty = true) {
10633     const fullSet = new Set();
10634     for (const alt of sequences) {
10635         const altSet = new Set();
10636         for (const tokType of alt) {
10637             if (tokType === undefined) {
10638                 if (allowEmpty) {
10639                     // Epsilon production encountered
10640                     break;
10641                 }
10642                 else {
10643                     return false;
10644                 }
10645             }
10646             const indices = [tokType.tokenTypeIdx].concat(tokType.categoryMatches);
10647             for (const index of indices) {
10648                 if (fullSet.has(index)) {
10649                     if (!altSet.has(index)) {
10650                         return false;
10651                     }
10652                 }
10653                 else {
10654                     fullSet.add(index);
10655                     altSet.add(index);
10656                 }
10657             }
10658         }
10659     }
10660     return true;
10661 }
10662 function initATNSimulator(atn) {
10663     const decisionLength = atn.decisionStates.length;
10664     const decisionToDFA = Array(decisionLength);
10665     for (let i = 0; i < decisionLength; i++) {
10666         decisionToDFA[i] = createDFACache(atn.decisionStates[i], i);
10667     }
10668     return decisionToDFA;
10669 }
10670 function adaptivePredict(dfaCaches, decision, predicateSet, logging) {
10671     const dfa = dfaCaches[decision](predicateSet);
10672     let start = dfa.start;
10673     if (start === undefined) {
10674         const closure = computeStartState(dfa.atnStartState);
10675         start = addDFAState(dfa, newDFAState(closure));
10676         dfa.start = start;
10677     }
10678     const alt = performLookahead.apply(this, [dfa, start, predicateSet, logging]);
10679     return alt;
10680 }
10681 function performLookahead(dfa, s0, predicateSet, logging) {
10682     let previousD = s0;
10683     let i = 1;
10684     const path = [];
10685     let t = this.LA(i++);
10686     while (true) {
10687         let d = getExistingTargetState(previousD, t);
10688         if (d === undefined) {
10689             d = computeLookaheadTarget.apply(this, [dfa, previousD, t, i, predicateSet, logging]);
10690         }
10691         if (d === DFA_ERROR) {
10692             return buildAdaptivePredictError(path, previousD, t);
10693         }
10694         if (d.isAcceptState === true) {
10695             return d.prediction;
10696         }
10697         previousD = d;
10698         path.push(t);
10699         t = this.LA(i++);
10700     }
10701 }
10702 function computeLookaheadTarget(dfa, previousD, token, lookahead, predicateSet, logging) {
10703     const reach = computeReachSet(previousD.configs, token, predicateSet);
10704     if (reach.size === 0) {
10705         addDFAEdge(dfa, previousD, token, DFA_ERROR);
10706         return DFA_ERROR;
10707     }
10708     let newState = newDFAState(reach);
10709     const predictedAlt = getUniqueAlt(reach, predicateSet);
10710     if (predictedAlt !== undefined) {
10711         newState.isAcceptState = true;
10712         newState.prediction = predictedAlt;
10713         newState.configs.uniqueAlt = predictedAlt;
10714     }
10715     else if (hasConflictTerminatingPrediction(reach)) {
10716         const prediction = (0,min/* default */.Z)(reach.alts);
10717         newState.isAcceptState = true;
10718         newState.prediction = prediction;
10719         newState.configs.uniqueAlt = prediction;
10720         reportLookaheadAmbiguity.apply(this, [dfa, lookahead, reach.alts, logging]);
10721     }
10722     newState = addDFAEdge(dfa, previousD, token, newState);
10723     return newState;
10724 }
10725 function reportLookaheadAmbiguity(dfa, lookahead, ambiguityIndices, logging) {
10726     const prefixPath = [];
10727     for (let i = 1; i <= lookahead; i++) {
10728         prefixPath.push(this.LA(i).tokenType);
10729     }
10730     const atnState = dfa.atnStartState;
10731     const topLevelRule = atnState.rule;
10732     const production = atnState.production;
10733     const message = buildAmbiguityError({
10734         topLevelRule,
10735         ambiguityIndices,
10736         production,
10737         prefixPath
10738     });
10739     logging(message);
10740 }
10741 function buildAmbiguityError(options) {
10742     const pathMsg = (0,map/* default */.Z)(options.prefixPath, (currtok) => (0,api/* tokenLabel */.l$)(currtok)).join(", ");
10743     const occurrence = options.production.idx === 0 ? "" : options.production.idx;
10744     let currMessage = `Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(", ")}> in <${getProductionDslName(options.production)}${occurrence}>` +
10745         ` inside <${options.topLevelRule.name}> Rule,\n` +
10746         `<${pathMsg}> may appears as a prefix path in all these alternatives.\n`;
10747     currMessage =
10748         currMessage +
10749             `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\n` +
10750             `For Further details.`;
10751     return currMessage;
10752 }
10753 function getProductionDslName(prod) {
10754     if (prod instanceof api/* NonTerminal */.Sj) {
10755         return "SUBRULE";
10756     }
10757     else if (prod instanceof api/* Option */.Wx) {
10758         return "OPTION";
10759     }
10760     else if (prod instanceof api/* Alternation */.ue) {
10761         return "OR";
10762     }
10763     else if (prod instanceof api/* RepetitionMandatory */.ej) {
10764         return "AT_LEAST_ONE";
10765     }
10766     else if (prod instanceof api/* RepetitionMandatoryWithSeparator */.fK) {
10767         return "AT_LEAST_ONE_SEP";
10768     }
10769     else if (prod instanceof api/* RepetitionWithSeparator */.pT) {
10770         return "MANY_SEP";
10771     }
10772     else if (prod instanceof api/* Repetition */.hI) {
10773         return "MANY";
10774     }
10775     else if (prod instanceof api/* Terminal */.oI) {
10776         return "CONSUME";
10777     }
10778     else {
10779         throw Error("non exhaustive match");
10780     }
10781 }
10782 function buildAdaptivePredictError(path, previous, current) {
10783     const nextTransitions = (0,flatMap/* default */.Z)(previous.configs.elements, (e) => e.state.transitions);
10784     const nextTokenTypes = lodash_es_uniqBy(nextTransitions
10785         .filter((e) => e instanceof AtomTransition)
10786         .map((e) => e.tokenType), (e) => e.tokenTypeIdx);
10787     return {
10788         actualToken: current,
10789         possibleTokenTypes: nextTokenTypes,
10790         tokenPath: path
10791     };
10792 }
10793 function getExistingTargetState(state, token) {
10794     return state.edges[token.tokenTypeIdx];
10795 }
10796 function computeReachSet(configs, token, predicateSet) {
10797     const intermediate = new ATNConfigSet();
10798     const skippedStopStates = [];
10799     for (const c of configs.elements) {
10800         if (predicateSet.is(c.alt) === false) {
10801             continue;
10802         }
10803         if (c.state.type === ATN_RULE_STOP) {
10804             skippedStopStates.push(c);
10805             continue;
10806         }
10807         const transitionLength = c.state.transitions.length;
10808         for (let i = 0; i < transitionLength; i++) {
10809             const transition = c.state.transitions[i];
10810             const target = getReachableTarget(transition, token);
10811             if (target !== undefined) {
10812                 intermediate.add({
10813                     state: target,
10814                     alt: c.alt,
10815                     stack: c.stack
10816                 });
10817             }
10818         }
10819     }
10820     let reach;
10821     if (skippedStopStates.length === 0 && intermediate.size === 1) {
10822         reach = intermediate;
10823     }
10824     if (reach === undefined) {
10825         reach = new ATNConfigSet();
10826         for (const c of intermediate.elements) {
10827             closure(c, reach);
10828         }
10829     }
10830     if (skippedStopStates.length > 0 && !hasConfigInRuleStopState(reach)) {
10831         for (const c of skippedStopStates) {
10832             reach.add(c);
10833         }
10834     }
10835     return reach;
10836 }
10837 function getReachableTarget(transition, token) {
10838     if (transition instanceof AtomTransition &&
10839         (0,api/* tokenMatcher */.ol)(token, transition.tokenType)) {
10840         return transition.target;
10841     }
10842     return undefined;
10843 }
10844 function getUniqueAlt(configs, predicateSet) {
10845     let alt;
10846     for (const c of configs.elements) {
10847         if (predicateSet.is(c.alt) === true) {
10848             if (alt === undefined) {
10849                 alt = c.alt;
10850             }
10851             else if (alt !== c.alt) {
10852                 return undefined;
10853             }
10854         }
10855     }
10856     return alt;
10857 }
10858 function newDFAState(closure) {
10859     return {
10860         configs: closure,
10861         edges: {},
10862         isAcceptState: false,
10863         prediction: -1
10864     };
10865 }
10866 function addDFAEdge(dfa, from, token, to) {
10867     to = addDFAState(dfa, to);
10868     from.edges[token.tokenTypeIdx] = to;
10869     return to;
10870 }
10871 function addDFAState(dfa, state) {
10872     if (state === DFA_ERROR) {
10873         return state;
10874     }
10875     // Repetitions have the same config set
10876     // Therefore, storing the key of the config in a map allows us to create a loop in our DFA
10877     const mapKey = state.configs.key;
10878     const existing = dfa.states[mapKey];
10879     if (existing !== undefined) {
10880         return existing;
10881     }
10882     state.configs.finalize();
10883     dfa.states[mapKey] = state;
10884     return state;
10885 }
10886 function computeStartState(atnState) {
10887     const configs = new ATNConfigSet();
10888     const numberOfTransitions = atnState.transitions.length;
10889     for (let i = 0; i < numberOfTransitions; i++) {
10890         const target = atnState.transitions[i].target;
10891         const config = {
10892             state: target,
10893             alt: i,
10894             stack: []
10895         };
10896         closure(config, configs);
10897     }
10898     return configs;
10899 }
10900 function closure(config, configs) {
10901     const p = config.state;
10902     if (p.type === ATN_RULE_STOP) {
10903         if (config.stack.length > 0) {
10904             const atnStack = [...config.stack];
10905             const followState = atnStack.pop();
10906             const followConfig = {
10907                 state: followState,
10908                 alt: config.alt,
10909                 stack: atnStack
10910             };
10911             closure(followConfig, configs);
10912         }
10913         else {
10914             // Dipping into outer context, simply add the config
10915             // This will stop computation once every config is at the rule stop state
10916             configs.add(config);
10917         }
10918         return;
10919     }
10920     if (!p.epsilonOnlyTransitions) {
10921         configs.add(config);
10922     }
10923     const transitionLength = p.transitions.length;
10924     for (let i = 0; i < transitionLength; i++) {
10925         const transition = p.transitions[i];
10926         const c = getEpsilonTarget(config, transition);
10927         if (c !== undefined) {
10928             closure(c, configs);
10929         }
10930     }
10931 }
10932 function getEpsilonTarget(config, transition) {
10933     if (transition instanceof EpsilonTransition) {
10934         return {
10935             state: transition.target,
10936             alt: config.alt,
10937             stack: config.stack
10938         };
10939     }
10940     else if (transition instanceof RuleTransition) {
10941         const stack = [...config.stack, transition.followState];
10942         return {
10943             state: transition.target,
10944             alt: config.alt,
10945             stack
10946         };
10947     }
10948     return undefined;
10949 }
10950 function hasConfigInRuleStopState(configs) {
10951     for (const c of configs.elements) {
10952         if (c.state.type === ATN_RULE_STOP) {
10953             return true;
10954         }
10955     }
10956     return false;
10957 }
10958 function allConfigsInRuleStopStates(configs) {
10959     for (const c of configs.elements) {
10960         if (c.state.type !== ATN_RULE_STOP) {
10961             return false;
10962         }
10963     }
10964     return true;
10965 }
10966 function hasConflictTerminatingPrediction(configs) {
10967     if (allConfigsInRuleStopStates(configs)) {
10968         return true;
10969     }
10970     const altSets = getConflictingAltSets(configs.elements);
10971     const heuristic = hasConflictingAltSet(altSets) && !hasStateAssociatedWithOneAlt(altSets);
10972     return heuristic;
10973 }
10974 function getConflictingAltSets(configs) {
10975     const configToAlts = new Map();
10976     for (const c of configs) {
10977         const key = getATNConfigKey(c, false);
10978         let alts = configToAlts.get(key);
10979         if (alts === undefined) {
10980             alts = {};
10981             configToAlts.set(key, alts);
10982         }
10983         alts[c.alt] = true;
10984     }
10985     return configToAlts;
10986 }
10987 function hasConflictingAltSet(altSets) {
10988     for (const value of Array.from(altSets.values())) {
10989         if (Object.keys(value).length > 1) {
10990             return true;
10991         }
10992     }
10993     return false;
10994 }
10995 function hasStateAssociatedWithOneAlt(altSets) {
10996     for (const value of Array.from(altSets.values())) {
10997         if (Object.keys(value).length === 1) {
10998             return true;
10999         }
11000     }
11001     return false;
11002 }
11003 //# sourceMappingURL=all-star-lookahead.js.map
11004 ;// CONCATENATED MODULE: ../node_modules/chevrotain-allstar/lib/index.js
11005 /******************************************************************************
11006  * Copyright 2022 TypeFox GmbH
11007  * This program and the accompanying materials are made available under the
11008  * terms of the MIT License, which is available in the project root.
11009  ******************************************************************************/
11010 
11011 //# sourceMappingURL=index.js.map
11012 // EXTERNAL MODULE: ../node_modules/langium/lib/utils/ast-utils.js
11013 var ast_utils = __webpack_require__(74857);
11014 ;// CONCATENATED MODULE: ../node_modules/vscode-languageserver-types/lib/esm/main.js
11015 /* -------------------------------------------------------------------------------------------- 
11016  * Copyright (c) Microsoft Corporation. All rights reserved. 
11017  * Licensed under the MIT License. See License.txt in the project root for license information. 
11018  * ------------------------------------------------------------------------------------------ */
11019 
11020 var DocumentUri;
11021 (function (DocumentUri) {
11022     function is(value) {
11023         return typeof value === 'string';
11024     }
11025     DocumentUri.is = is;
11026 })(DocumentUri || (DocumentUri = {}));
11027 var URI;
11028 (function (URI) {
11029     function is(value) {
11030         return typeof value === 'string';
11031     }
11032     URI.is = is;
11033 })(URI || (URI = {}));
11034 var integer;
11035 (function (integer) {
11036     integer.MIN_VALUE = -2147483648;
11037     integer.MAX_VALUE = 2147483647;
11038     function is(value) {
11039         return typeof value === 'number' && integer.MIN_VALUE <= value && value <= integer.MAX_VALUE;
11040     }
11041     integer.is = is;
11042 })(integer || (integer = {}));
11043 var uinteger;
11044 (function (uinteger) {
11045     uinteger.MIN_VALUE = 0;
11046     uinteger.MAX_VALUE = 2147483647;
11047     function is(value) {
11048         return typeof value === 'number' && uinteger.MIN_VALUE <= value && value <= uinteger.MAX_VALUE;
11049     }
11050     uinteger.is = is;
11051 })(uinteger || (uinteger = {}));
11052 /**
11053  * The Position namespace provides helper functions to work with
11054  * {@link Position} literals.
11055  */
11056 var Position;
11057 (function (Position) {
11058     /**
11059      * Creates a new Position literal from the given line and character.
11060      * @param line The position's line.
11061      * @param character The position's character.
11062      */
11063     function create(line, character) {
11064         if (line === Number.MAX_VALUE) {
11065             line = uinteger.MAX_VALUE;
11066         }
11067         if (character === Number.MAX_VALUE) {
11068             character = uinteger.MAX_VALUE;
11069         }
11070         return { line, character };
11071     }
11072     Position.create = create;
11073     /**
11074      * Checks whether the given literal conforms to the {@link Position} interface.
11075      */
11076     function is(value) {
11077         let candidate = value;
11078         return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
11079     }
11080     Position.is = is;
11081 })(Position || (Position = {}));
11082 /**
11083  * The Range namespace provides helper functions to work with
11084  * {@link Range} literals.
11085  */
11086 var Range;
11087 (function (Range) {
11088     function create(one, two, three, four) {
11089         if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
11090             return { start: Position.create(one, two), end: Position.create(three, four) };
11091         }
11092         else if (Position.is(one) && Position.is(two)) {
11093             return { start: one, end: two };
11094         }
11095         else {
11096             throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`);
11097         }
11098     }
11099     Range.create = create;
11100     /**
11101      * Checks whether the given literal conforms to the {@link Range} interface.
11102      */
11103     function is(value) {
11104         let candidate = value;
11105         return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
11106     }
11107     Range.is = is;
11108 })(Range || (Range = {}));
11109 /**
11110  * The Location namespace provides helper functions to work with
11111  * {@link Location} literals.
11112  */
11113 var Location;
11114 (function (Location) {
11115     /**
11116      * Creates a Location literal.
11117      * @param uri The location's uri.
11118      * @param range The location's range.
11119      */
11120     function create(uri, range) {
11121         return { uri, range };
11122     }
11123     Location.create = create;
11124     /**
11125      * Checks whether the given literal conforms to the {@link Location} interface.
11126      */
11127     function is(value) {
11128         let candidate = value;
11129         return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
11130     }
11131     Location.is = is;
11132 })(Location || (Location = {}));
11133 /**
11134  * The LocationLink namespace provides helper functions to work with
11135  * {@link LocationLink} literals.
11136  */
11137 var LocationLink;
11138 (function (LocationLink) {
11139     /**
11140      * Creates a LocationLink literal.
11141      * @param targetUri The definition's uri.
11142      * @param targetRange The full range of the definition.
11143      * @param targetSelectionRange The span of the symbol definition at the target.
11144      * @param originSelectionRange The span of the symbol being defined in the originating source file.
11145      */
11146     function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
11147         return { targetUri, targetRange, targetSelectionRange, originSelectionRange };
11148     }
11149     LocationLink.create = create;
11150     /**
11151      * Checks whether the given literal conforms to the {@link LocationLink} interface.
11152      */
11153     function is(value) {
11154         let candidate = value;
11155         return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
11156             && Range.is(candidate.targetSelectionRange)
11157             && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
11158     }
11159     LocationLink.is = is;
11160 })(LocationLink || (LocationLink = {}));
11161 /**
11162  * The Color namespace provides helper functions to work with
11163  * {@link Color} literals.
11164  */
11165 var Color;
11166 (function (Color) {
11167     /**
11168      * Creates a new Color literal.
11169      */
11170     function create(red, green, blue, alpha) {
11171         return {
11172             red,
11173             green,
11174             blue,
11175             alpha,
11176         };
11177     }
11178     Color.create = create;
11179     /**
11180      * Checks whether the given literal conforms to the {@link Color} interface.
11181      */
11182     function is(value) {
11183         const candidate = value;
11184         return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1)
11185             && Is.numberRange(candidate.green, 0, 1)
11186             && Is.numberRange(candidate.blue, 0, 1)
11187             && Is.numberRange(candidate.alpha, 0, 1);
11188     }
11189     Color.is = is;
11190 })(Color || (Color = {}));
11191 /**
11192  * The ColorInformation namespace provides helper functions to work with
11193  * {@link ColorInformation} literals.
11194  */
11195 var ColorInformation;
11196 (function (ColorInformation) {
11197     /**
11198      * Creates a new ColorInformation literal.
11199      */
11200     function create(range, color) {
11201         return {
11202             range,
11203             color,
11204         };
11205     }
11206     ColorInformation.create = create;
11207     /**
11208      * Checks whether the given literal conforms to the {@link ColorInformation} interface.
11209      */
11210     function is(value) {
11211         const candidate = value;
11212         return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color);
11213     }
11214     ColorInformation.is = is;
11215 })(ColorInformation || (ColorInformation = {}));
11216 /**
11217  * The Color namespace provides helper functions to work with
11218  * {@link ColorPresentation} literals.
11219  */
11220 var ColorPresentation;
11221 (function (ColorPresentation) {
11222     /**
11223      * Creates a new ColorInformation literal.
11224      */
11225     function create(label, textEdit, additionalTextEdits) {
11226         return {
11227             label,
11228             textEdit,
11229             additionalTextEdits,
11230         };
11231     }
11232     ColorPresentation.create = create;
11233     /**
11234      * Checks whether the given literal conforms to the {@link ColorInformation} interface.
11235      */
11236     function is(value) {
11237         const candidate = value;
11238         return Is.objectLiteral(candidate) && Is.string(candidate.label)
11239             && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
11240             && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
11241     }
11242     ColorPresentation.is = is;
11243 })(ColorPresentation || (ColorPresentation = {}));
11244 /**
11245  * A set of predefined range kinds.
11246  */
11247 var FoldingRangeKind;
11248 (function (FoldingRangeKind) {
11249     /**
11250      * Folding range for a comment
11251      */
11252     FoldingRangeKind.Comment = 'comment';
11253     /**
11254      * Folding range for an import or include
11255      */
11256     FoldingRangeKind.Imports = 'imports';
11257     /**
11258      * Folding range for a region (e.g. `#region`)
11259      */
11260     FoldingRangeKind.Region = 'region';
11261 })(FoldingRangeKind || (FoldingRangeKind = {}));
11262 /**
11263  * The folding range namespace provides helper functions to work with
11264  * {@link FoldingRange} literals.
11265  */
11266 var FoldingRange;
11267 (function (FoldingRange) {
11268     /**
11269      * Creates a new FoldingRange literal.
11270      */
11271     function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) {
11272         const result = {
11273             startLine,
11274             endLine
11275         };
11276         if (Is.defined(startCharacter)) {
11277             result.startCharacter = startCharacter;
11278         }
11279         if (Is.defined(endCharacter)) {
11280             result.endCharacter = endCharacter;
11281         }
11282         if (Is.defined(kind)) {
11283             result.kind = kind;
11284         }
11285         if (Is.defined(collapsedText)) {
11286             result.collapsedText = collapsedText;
11287         }
11288         return result;
11289     }
11290     FoldingRange.create = create;
11291     /**
11292      * Checks whether the given literal conforms to the {@link FoldingRange} interface.
11293      */
11294     function is(value) {
11295         const candidate = value;
11296         return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)
11297             && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))
11298             && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))
11299             && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
11300     }
11301     FoldingRange.is = is;
11302 })(FoldingRange || (FoldingRange = {}));
11303 /**
11304  * The DiagnosticRelatedInformation namespace provides helper functions to work with
11305  * {@link DiagnosticRelatedInformation} literals.
11306  */
11307 var DiagnosticRelatedInformation;
11308 (function (DiagnosticRelatedInformation) {
11309     /**
11310      * Creates a new DiagnosticRelatedInformation literal.
11311      */
11312     function create(location, message) {
11313         return {
11314             location,
11315             message
11316         };
11317     }
11318     DiagnosticRelatedInformation.create = create;
11319     /**
11320      * Checks whether the given literal conforms to the {@link DiagnosticRelatedInformation} interface.
11321      */
11322     function is(value) {
11323         let candidate = value;
11324         return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
11325     }
11326     DiagnosticRelatedInformation.is = is;
11327 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
11328 /**
11329  * The diagnostic's severity.
11330  */
11331 var DiagnosticSeverity;
11332 (function (DiagnosticSeverity) {
11333     /**
11334      * Reports an error.
11335      */
11336     DiagnosticSeverity.Error = 1;
11337     /**
11338      * Reports a warning.
11339      */
11340     DiagnosticSeverity.Warning = 2;
11341     /**
11342      * Reports an information.
11343      */
11344     DiagnosticSeverity.Information = 3;
11345     /**
11346      * Reports a hint.
11347      */
11348     DiagnosticSeverity.Hint = 4;
11349 })(DiagnosticSeverity || (DiagnosticSeverity = {}));
11350 /**
11351  * The diagnostic tags.
11352  *
11353  * @since 3.15.0
11354  */
11355 var DiagnosticTag;
11356 (function (DiagnosticTag) {
11357     /**
11358      * Unused or unnecessary code.
11359      *
11360      * Clients are allowed to render diagnostics with this tag faded out instead of having
11361      * an error squiggle.
11362      */
11363     DiagnosticTag.Unnecessary = 1;
11364     /**
11365      * Deprecated or obsolete code.
11366      *
11367      * Clients are allowed to rendered diagnostics with this tag strike through.
11368      */
11369     DiagnosticTag.Deprecated = 2;
11370 })(DiagnosticTag || (DiagnosticTag = {}));
11371 /**
11372  * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.
11373  *
11374  * @since 3.16.0
11375  */
11376 var CodeDescription;
11377 (function (CodeDescription) {
11378     function is(value) {
11379         const candidate = value;
11380         return Is.objectLiteral(candidate) && Is.string(candidate.href);
11381     }
11382     CodeDescription.is = is;
11383 })(CodeDescription || (CodeDescription = {}));
11384 /**
11385  * The Diagnostic namespace provides helper functions to work with
11386  * {@link Diagnostic} literals.
11387  */
11388 var Diagnostic;
11389 (function (Diagnostic) {
11390     /**
11391      * Creates a new Diagnostic literal.
11392      */
11393     function create(range, message, severity, code, source, relatedInformation) {
11394         let result = { range, message };
11395         if (Is.defined(severity)) {
11396             result.severity = severity;
11397         }
11398         if (Is.defined(code)) {
11399             result.code = code;
11400         }
11401         if (Is.defined(source)) {
11402             result.source = source;
11403         }
11404         if (Is.defined(relatedInformation)) {
11405             result.relatedInformation = relatedInformation;
11406         }
11407         return result;
11408     }
11409     Diagnostic.create = create;
11410     /**
11411      * Checks whether the given literal conforms to the {@link Diagnostic} interface.
11412      */
11413     function is(value) {
11414         var _a;
11415         let candidate = value;
11416         return Is.defined(candidate)
11417             && Range.is(candidate.range)
11418             && Is.string(candidate.message)
11419             && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
11420             && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
11421             && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))
11422             && (Is.string(candidate.source) || Is.undefined(candidate.source))
11423             && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
11424     }
11425     Diagnostic.is = is;
11426 })(Diagnostic || (Diagnostic = {}));
11427 /**
11428  * The Command namespace provides helper functions to work with
11429  * {@link Command} literals.
11430  */
11431 var Command;
11432 (function (Command) {
11433     /**
11434      * Creates a new Command literal.
11435      */
11436     function create(title, command, ...args) {
11437         let result = { title, command };
11438         if (Is.defined(args) && args.length > 0) {
11439             result.arguments = args;
11440         }
11441         return result;
11442     }
11443     Command.create = create;
11444     /**
11445      * Checks whether the given literal conforms to the {@link Command} interface.
11446      */
11447     function is(value) {
11448         let candidate = value;
11449         return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
11450     }
11451     Command.is = is;
11452 })(Command || (Command = {}));
11453 /**
11454  * The TextEdit namespace provides helper function to create replace,
11455  * insert and delete edits more easily.
11456  */
11457 var TextEdit;
11458 (function (TextEdit) {
11459     /**
11460      * Creates a replace text edit.
11461      * @param range The range of text to be replaced.
11462      * @param newText The new text.
11463      */
11464     function replace(range, newText) {
11465         return { range, newText };
11466     }
11467     TextEdit.replace = replace;
11468     /**
11469      * Creates an insert text edit.
11470      * @param position The position to insert the text at.
11471      * @param newText The text to be inserted.
11472      */
11473     function insert(position, newText) {
11474         return { range: { start: position, end: position }, newText };
11475     }
11476     TextEdit.insert = insert;
11477     /**
11478      * Creates a delete text edit.
11479      * @param range The range of text to be deleted.
11480      */
11481     function del(range) {
11482         return { range, newText: '' };
11483     }
11484     TextEdit.del = del;
11485     function is(value) {
11486         const candidate = value;
11487         return Is.objectLiteral(candidate)
11488             && Is.string(candidate.newText)
11489             && Range.is(candidate.range);
11490     }
11491     TextEdit.is = is;
11492 })(TextEdit || (TextEdit = {}));
11493 var ChangeAnnotation;
11494 (function (ChangeAnnotation) {
11495     function create(label, needsConfirmation, description) {
11496         const result = { label };
11497         if (needsConfirmation !== undefined) {
11498             result.needsConfirmation = needsConfirmation;
11499         }
11500         if (description !== undefined) {
11501             result.description = description;
11502         }
11503         return result;
11504     }
11505     ChangeAnnotation.create = create;
11506     function is(value) {
11507         const candidate = value;
11508         return Is.objectLiteral(candidate) && Is.string(candidate.label) &&
11509             (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&
11510             (Is.string(candidate.description) || candidate.description === undefined);
11511     }
11512     ChangeAnnotation.is = is;
11513 })(ChangeAnnotation || (ChangeAnnotation = {}));
11514 var ChangeAnnotationIdentifier;
11515 (function (ChangeAnnotationIdentifier) {
11516     function is(value) {
11517         const candidate = value;
11518         return Is.string(candidate);
11519     }
11520     ChangeAnnotationIdentifier.is = is;
11521 })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
11522 var AnnotatedTextEdit;
11523 (function (AnnotatedTextEdit) {
11524     /**
11525      * Creates an annotated replace text edit.
11526      *
11527      * @param range The range of text to be replaced.
11528      * @param newText The new text.
11529      * @param annotation The annotation.
11530      */
11531     function replace(range, newText, annotation) {
11532         return { range, newText, annotationId: annotation };
11533     }
11534     AnnotatedTextEdit.replace = replace;
11535     /**
11536      * Creates an annotated insert text edit.
11537      *
11538      * @param position The position to insert the text at.
11539      * @param newText The text to be inserted.
11540      * @param annotation The annotation.
11541      */
11542     function insert(position, newText, annotation) {
11543         return { range: { start: position, end: position }, newText, annotationId: annotation };
11544     }
11545     AnnotatedTextEdit.insert = insert;
11546     /**
11547      * Creates an annotated delete text edit.
11548      *
11549      * @param range The range of text to be deleted.
11550      * @param annotation The annotation.
11551      */
11552     function del(range, annotation) {
11553         return { range, newText: '', annotationId: annotation };
11554     }
11555     AnnotatedTextEdit.del = del;
11556     function is(value) {
11557         const candidate = value;
11558         return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
11559     }
11560     AnnotatedTextEdit.is = is;
11561 })(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
11562 /**
11563  * The TextDocumentEdit namespace provides helper function to create
11564  * an edit that manipulates a text document.
11565  */
11566 var TextDocumentEdit;
11567 (function (TextDocumentEdit) {
11568     /**
11569      * Creates a new `TextDocumentEdit`
11570      */
11571     function create(textDocument, edits) {
11572         return { textDocument, edits };
11573     }
11574     TextDocumentEdit.create = create;
11575     function is(value) {
11576         let candidate = value;
11577         return Is.defined(candidate)
11578             && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)
11579             && Array.isArray(candidate.edits);
11580     }
11581     TextDocumentEdit.is = is;
11582 })(TextDocumentEdit || (TextDocumentEdit = {}));
11583 var CreateFile;
11584 (function (CreateFile) {
11585     function create(uri, options, annotation) {
11586         let result = {
11587             kind: 'create',
11588             uri
11589         };
11590         if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
11591             result.options = options;
11592         }
11593         if (annotation !== undefined) {
11594             result.annotationId = annotation;
11595         }
11596         return result;
11597     }
11598     CreateFile.create = create;
11599     function is(value) {
11600         let candidate = value;
11601         return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||
11602             ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
11603     }
11604     CreateFile.is = is;
11605 })(CreateFile || (CreateFile = {}));
11606 var RenameFile;
11607 (function (RenameFile) {
11608     function create(oldUri, newUri, options, annotation) {
11609         let result = {
11610             kind: 'rename',
11611             oldUri,
11612             newUri
11613         };
11614         if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
11615             result.options = options;
11616         }
11617         if (annotation !== undefined) {
11618             result.annotationId = annotation;
11619         }
11620         return result;
11621     }
11622     RenameFile.create = create;
11623     function is(value) {
11624         let candidate = value;
11625         return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||
11626             ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
11627     }
11628     RenameFile.is = is;
11629 })(RenameFile || (RenameFile = {}));
11630 var DeleteFile;
11631 (function (DeleteFile) {
11632     function create(uri, options, annotation) {
11633         let result = {
11634             kind: 'delete',
11635             uri
11636         };
11637         if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {
11638             result.options = options;
11639         }
11640         if (annotation !== undefined) {
11641             result.annotationId = annotation;
11642         }
11643         return result;
11644     }
11645     DeleteFile.create = create;
11646     function is(value) {
11647         let candidate = value;
11648         return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||
11649             ((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
11650     }
11651     DeleteFile.is = is;
11652 })(DeleteFile || (DeleteFile = {}));
11653 var WorkspaceEdit;
11654 (function (WorkspaceEdit) {
11655     function is(value) {
11656         let candidate = value;
11657         return candidate &&
11658             (candidate.changes !== undefined || candidate.documentChanges !== undefined) &&
11659             (candidate.documentChanges === undefined || candidate.documentChanges.every((change) => {
11660                 if (Is.string(change.kind)) {
11661                     return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
11662                 }
11663                 else {
11664                     return TextDocumentEdit.is(change);
11665                 }
11666             }));
11667     }
11668     WorkspaceEdit.is = is;
11669 })(WorkspaceEdit || (WorkspaceEdit = {}));
11670 class TextEditChangeImpl {
11671     constructor(edits, changeAnnotations) {
11672         this.edits = edits;
11673         this.changeAnnotations = changeAnnotations;
11674     }
11675     insert(position, newText, annotation) {
11676         let edit;
11677         let id;
11678         if (annotation === undefined) {
11679             edit = TextEdit.insert(position, newText);
11680         }
11681         else if (ChangeAnnotationIdentifier.is(annotation)) {
11682             id = annotation;
11683             edit = AnnotatedTextEdit.insert(position, newText, annotation);
11684         }
11685         else {
11686             this.assertChangeAnnotations(this.changeAnnotations);
11687             id = this.changeAnnotations.manage(annotation);
11688             edit = AnnotatedTextEdit.insert(position, newText, id);
11689         }
11690         this.edits.push(edit);
11691         if (id !== undefined) {
11692             return id;
11693         }
11694     }
11695     replace(range, newText, annotation) {
11696         let edit;
11697         let id;
11698         if (annotation === undefined) {
11699             edit = TextEdit.replace(range, newText);
11700         }
11701         else if (ChangeAnnotationIdentifier.is(annotation)) {
11702             id = annotation;
11703             edit = AnnotatedTextEdit.replace(range, newText, annotation);
11704         }
11705         else {
11706             this.assertChangeAnnotations(this.changeAnnotations);
11707             id = this.changeAnnotations.manage(annotation);
11708             edit = AnnotatedTextEdit.replace(range, newText, id);
11709         }
11710         this.edits.push(edit);
11711         if (id !== undefined) {
11712             return id;
11713         }
11714     }
11715     delete(range, annotation) {
11716         let edit;
11717         let id;
11718         if (annotation === undefined) {
11719             edit = TextEdit.del(range);
11720         }
11721         else if (ChangeAnnotationIdentifier.is(annotation)) {
11722             id = annotation;
11723             edit = AnnotatedTextEdit.del(range, annotation);
11724         }
11725         else {
11726             this.assertChangeAnnotations(this.changeAnnotations);
11727             id = this.changeAnnotations.manage(annotation);
11728             edit = AnnotatedTextEdit.del(range, id);
11729         }
11730         this.edits.push(edit);
11731         if (id !== undefined) {
11732             return id;
11733         }
11734     }
11735     add(edit) {
11736         this.edits.push(edit);
11737     }
11738     all() {
11739         return this.edits;
11740     }
11741     clear() {
11742         this.edits.splice(0, this.edits.length);
11743     }
11744     assertChangeAnnotations(value) {
11745         if (value === undefined) {
11746             throw new Error(`Text edit change is not configured to manage change annotations.`);
11747         }
11748     }
11749 }
11750 /**
11751  * A helper class
11752  */
11753 class ChangeAnnotations {
11754     constructor(annotations) {
11755         this._annotations = annotations === undefined ? Object.create(null) : annotations;
11756         this._counter = 0;
11757         this._size = 0;
11758     }
11759     all() {
11760         return this._annotations;
11761     }
11762     get size() {
11763         return this._size;
11764     }
11765     manage(idOrAnnotation, annotation) {
11766         let id;
11767         if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
11768             id = idOrAnnotation;
11769         }
11770         else {
11771             id = this.nextId();
11772             annotation = idOrAnnotation;
11773         }
11774         if (this._annotations[id] !== undefined) {
11775             throw new Error(`Id ${id} is already in use.`);
11776         }
11777         if (annotation === undefined) {
11778             throw new Error(`No annotation provided for id ${id}`);
11779         }
11780         this._annotations[id] = annotation;
11781         this._size++;
11782         return id;
11783     }
11784     nextId() {
11785         this._counter++;
11786         return this._counter.toString();
11787     }
11788 }
11789 /**
11790  * A workspace change helps constructing changes to a workspace.
11791  */
11792 class WorkspaceChange {
11793     constructor(workspaceEdit) {
11794         this._textEditChanges = Object.create(null);
11795         if (workspaceEdit !== undefined) {
11796             this._workspaceEdit = workspaceEdit;
11797             if (workspaceEdit.documentChanges) {
11798                 this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
11799                 workspaceEdit.changeAnnotations = this._changeAnnotations.all();
11800                 workspaceEdit.documentChanges.forEach((change) => {
11801                     if (TextDocumentEdit.is(change)) {
11802                         const textEditChange = new TextEditChangeImpl(change.edits, this._changeAnnotations);
11803                         this._textEditChanges[change.textDocument.uri] = textEditChange;
11804                     }
11805                 });
11806             }
11807             else if (workspaceEdit.changes) {
11808                 Object.keys(workspaceEdit.changes).forEach((key) => {
11809                     const textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
11810                     this._textEditChanges[key] = textEditChange;
11811                 });
11812             }
11813         }
11814         else {
11815             this._workspaceEdit = {};
11816         }
11817     }
11818     /**
11819      * Returns the underlying {@link WorkspaceEdit} literal
11820      * use to be returned from a workspace edit operation like rename.
11821      */
11822     get edit() {
11823         this.initDocumentChanges();
11824         if (this._changeAnnotations !== undefined) {
11825             if (this._changeAnnotations.size === 0) {
11826                 this._workspaceEdit.changeAnnotations = undefined;
11827             }
11828             else {
11829                 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
11830             }
11831         }
11832         return this._workspaceEdit;
11833     }
11834     getTextEditChange(key) {
11835         if (OptionalVersionedTextDocumentIdentifier.is(key)) {
11836             this.initDocumentChanges();
11837             if (this._workspaceEdit.documentChanges === undefined) {
11838                 throw new Error('Workspace edit is not configured for document changes.');
11839             }
11840             const textDocument = { uri: key.uri, version: key.version };
11841             let result = this._textEditChanges[textDocument.uri];
11842             if (!result) {
11843                 const edits = [];
11844                 const textDocumentEdit = {
11845                     textDocument,
11846                     edits
11847                 };
11848                 this._workspaceEdit.documentChanges.push(textDocumentEdit);
11849                 result = new TextEditChangeImpl(edits, this._changeAnnotations);
11850                 this._textEditChanges[textDocument.uri] = result;
11851             }
11852             return result;
11853         }
11854         else {
11855             this.initChanges();
11856             if (this._workspaceEdit.changes === undefined) {
11857                 throw new Error('Workspace edit is not configured for normal text edit changes.');
11858             }
11859             let result = this._textEditChanges[key];
11860             if (!result) {
11861                 let edits = [];
11862                 this._workspaceEdit.changes[key] = edits;
11863                 result = new TextEditChangeImpl(edits);
11864                 this._textEditChanges[key] = result;
11865             }
11866             return result;
11867         }
11868     }
11869     initDocumentChanges() {
11870         if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
11871             this._changeAnnotations = new ChangeAnnotations();
11872             this._workspaceEdit.documentChanges = [];
11873             this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
11874         }
11875     }
11876     initChanges() {
11877         if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
11878             this._workspaceEdit.changes = Object.create(null);
11879         }
11880     }
11881     createFile(uri, optionsOrAnnotation, options) {
11882         this.initDocumentChanges();
11883         if (this._workspaceEdit.documentChanges === undefined) {
11884             throw new Error('Workspace edit is not configured for document changes.');
11885         }
11886         let annotation;
11887         if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
11888             annotation = optionsOrAnnotation;
11889         }
11890         else {
11891             options = optionsOrAnnotation;
11892         }
11893         let operation;
11894         let id;
11895         if (annotation === undefined) {
11896             operation = CreateFile.create(uri, options);
11897         }
11898         else {
11899             id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
11900             operation = CreateFile.create(uri, options, id);
11901         }
11902         this._workspaceEdit.documentChanges.push(operation);
11903         if (id !== undefined) {
11904             return id;
11905         }
11906     }
11907     renameFile(oldUri, newUri, optionsOrAnnotation, options) {
11908         this.initDocumentChanges();
11909         if (this._workspaceEdit.documentChanges === undefined) {
11910             throw new Error('Workspace edit is not configured for document changes.');
11911         }
11912         let annotation;
11913         if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
11914             annotation = optionsOrAnnotation;
11915         }
11916         else {
11917             options = optionsOrAnnotation;
11918         }
11919         let operation;
11920         let id;
11921         if (annotation === undefined) {
11922             operation = RenameFile.create(oldUri, newUri, options);
11923         }
11924         else {
11925             id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
11926             operation = RenameFile.create(oldUri, newUri, options, id);
11927         }
11928         this._workspaceEdit.documentChanges.push(operation);
11929         if (id !== undefined) {
11930             return id;
11931         }
11932     }
11933     deleteFile(uri, optionsOrAnnotation, options) {
11934         this.initDocumentChanges();
11935         if (this._workspaceEdit.documentChanges === undefined) {
11936             throw new Error('Workspace edit is not configured for document changes.');
11937         }
11938         let annotation;
11939         if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
11940             annotation = optionsOrAnnotation;
11941         }
11942         else {
11943             options = optionsOrAnnotation;
11944         }
11945         let operation;
11946         let id;
11947         if (annotation === undefined) {
11948             operation = DeleteFile.create(uri, options);
11949         }
11950         else {
11951             id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
11952             operation = DeleteFile.create(uri, options, id);
11953         }
11954         this._workspaceEdit.documentChanges.push(operation);
11955         if (id !== undefined) {
11956             return id;
11957         }
11958     }
11959 }
11960 /**
11961  * The TextDocumentIdentifier namespace provides helper functions to work with
11962  * {@link TextDocumentIdentifier} literals.
11963  */
11964 var TextDocumentIdentifier;
11965 (function (TextDocumentIdentifier) {
11966     /**
11967      * Creates a new TextDocumentIdentifier literal.
11968      * @param uri The document's uri.
11969      */
11970     function create(uri) {
11971         return { uri };
11972     }
11973     TextDocumentIdentifier.create = create;
11974     /**
11975      * Checks whether the given literal conforms to the {@link TextDocumentIdentifier} interface.
11976      */
11977     function is(value) {
11978         let candidate = value;
11979         return Is.defined(candidate) && Is.string(candidate.uri);
11980     }
11981     TextDocumentIdentifier.is = is;
11982 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
11983 /**
11984  * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
11985  * {@link VersionedTextDocumentIdentifier} literals.
11986  */
11987 var VersionedTextDocumentIdentifier;
11988 (function (VersionedTextDocumentIdentifier) {
11989     /**
11990      * Creates a new VersionedTextDocumentIdentifier literal.
11991      * @param uri The document's uri.
11992      * @param version The document's version.
11993      */
11994     function create(uri, version) {
11995         return { uri, version };
11996     }
11997     VersionedTextDocumentIdentifier.create = create;
11998     /**
11999      * Checks whether the given literal conforms to the {@link VersionedTextDocumentIdentifier} interface.
12000      */
12001     function is(value) {
12002         let candidate = value;
12003         return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
12004     }
12005     VersionedTextDocumentIdentifier.is = is;
12006 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
12007 /**
12008  * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with
12009  * {@link OptionalVersionedTextDocumentIdentifier} literals.
12010  */
12011 var OptionalVersionedTextDocumentIdentifier;
12012 (function (OptionalVersionedTextDocumentIdentifier) {
12013     /**
12014      * Creates a new OptionalVersionedTextDocumentIdentifier literal.
12015      * @param uri The document's uri.
12016      * @param version The document's version.
12017      */
12018     function create(uri, version) {
12019         return { uri, version };
12020     }
12021     OptionalVersionedTextDocumentIdentifier.create = create;
12022     /**
12023      * Checks whether the given literal conforms to the {@link OptionalVersionedTextDocumentIdentifier} interface.
12024      */
12025     function is(value) {
12026         let candidate = value;
12027         return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
12028     }
12029     OptionalVersionedTextDocumentIdentifier.is = is;
12030 })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
12031 /**
12032  * The TextDocumentItem namespace provides helper functions to work with
12033  * {@link TextDocumentItem} literals.
12034  */
12035 var TextDocumentItem;
12036 (function (TextDocumentItem) {
12037     /**
12038      * Creates a new TextDocumentItem literal.
12039      * @param uri The document's uri.
12040      * @param languageId The document's language identifier.
12041      * @param version The document's version number.
12042      * @param text The document's text.
12043      */
12044     function create(uri, languageId, version, text) {
12045         return { uri, languageId, version, text };
12046     }
12047     TextDocumentItem.create = create;
12048     /**
12049      * Checks whether the given literal conforms to the {@link TextDocumentItem} interface.
12050      */
12051     function is(value) {
12052         let candidate = value;
12053         return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
12054     }
12055     TextDocumentItem.is = is;
12056 })(TextDocumentItem || (TextDocumentItem = {}));
12057 /**
12058  * Describes the content type that a client supports in various
12059  * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
12060  *
12061  * Please note that `MarkupKinds` must not start with a `$`. This kinds
12062  * are reserved for internal usage.
12063  */
12064 var MarkupKind;
12065 (function (MarkupKind) {
12066     /**
12067      * Plain text is supported as a content format
12068      */
12069     MarkupKind.PlainText = 'plaintext';
12070     /**
12071      * Markdown is supported as a content format
12072      */
12073     MarkupKind.Markdown = 'markdown';
12074     /**
12075      * Checks whether the given value is a value of the {@link MarkupKind} type.
12076      */
12077     function is(value) {
12078         const candidate = value;
12079         return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
12080     }
12081     MarkupKind.is = is;
12082 })(MarkupKind || (MarkupKind = {}));
12083 var MarkupContent;
12084 (function (MarkupContent) {
12085     /**
12086      * Checks whether the given value conforms to the {@link MarkupContent} interface.
12087      */
12088     function is(value) {
12089         const candidate = value;
12090         return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
12091     }
12092     MarkupContent.is = is;
12093 })(MarkupContent || (MarkupContent = {}));
12094 /**
12095  * The kind of a completion entry.
12096  */
12097 var CompletionItemKind;
12098 (function (CompletionItemKind) {
12099     CompletionItemKind.Text = 1;
12100     CompletionItemKind.Method = 2;
12101     CompletionItemKind.Function = 3;
12102     CompletionItemKind.Constructor = 4;
12103     CompletionItemKind.Field = 5;
12104     CompletionItemKind.Variable = 6;
12105     CompletionItemKind.Class = 7;
12106     CompletionItemKind.Interface = 8;
12107     CompletionItemKind.Module = 9;
12108     CompletionItemKind.Property = 10;
12109     CompletionItemKind.Unit = 11;
12110     CompletionItemKind.Value = 12;
12111     CompletionItemKind.Enum = 13;
12112     CompletionItemKind.Keyword = 14;
12113     CompletionItemKind.Snippet = 15;
12114     CompletionItemKind.Color = 16;
12115     CompletionItemKind.File = 17;
12116     CompletionItemKind.Reference = 18;
12117     CompletionItemKind.Folder = 19;
12118     CompletionItemKind.EnumMember = 20;
12119     CompletionItemKind.Constant = 21;
12120     CompletionItemKind.Struct = 22;
12121     CompletionItemKind.Event = 23;
12122     CompletionItemKind.Operator = 24;
12123     CompletionItemKind.TypeParameter = 25;
12124 })(CompletionItemKind || (CompletionItemKind = {}));
12125 /**
12126  * Defines whether the insert text in a completion item should be interpreted as
12127  * plain text or a snippet.
12128  */
12129 var InsertTextFormat;
12130 (function (InsertTextFormat) {
12131     /**
12132      * The primary text to be inserted is treated as a plain string.
12133      */
12134     InsertTextFormat.PlainText = 1;
12135     /**
12136      * The primary text to be inserted is treated as a snippet.
12137      *
12138      * A snippet can define tab stops and placeholders with `$1`, `$2`
12139      * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
12140      * the end of the snippet. Placeholders with equal identifiers are linked,
12141      * that is typing in one will update others too.
12142      *
12143      * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
12144      */
12145     InsertTextFormat.Snippet = 2;
12146 })(InsertTextFormat || (InsertTextFormat = {}));
12147 /**
12148  * Completion item tags are extra annotations that tweak the rendering of a completion
12149  * item.
12150  *
12151  * @since 3.15.0
12152  */
12153 var CompletionItemTag;
12154 (function (CompletionItemTag) {
12155     /**
12156      * Render a completion as obsolete, usually using a strike-out.
12157      */
12158     CompletionItemTag.Deprecated = 1;
12159 })(CompletionItemTag || (CompletionItemTag = {}));
12160 /**
12161  * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.
12162  *
12163  * @since 3.16.0
12164  */
12165 var InsertReplaceEdit;
12166 (function (InsertReplaceEdit) {
12167     /**
12168      * Creates a new insert / replace edit
12169      */
12170     function create(newText, insert, replace) {
12171         return { newText, insert, replace };
12172     }
12173     InsertReplaceEdit.create = create;
12174     /**
12175      * Checks whether the given literal conforms to the {@link InsertReplaceEdit} interface.
12176      */
12177     function is(value) {
12178         const candidate = value;
12179         return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
12180     }
12181     InsertReplaceEdit.is = is;
12182 })(InsertReplaceEdit || (InsertReplaceEdit = {}));
12183 /**
12184  * How whitespace and indentation is handled during completion
12185  * item insertion.
12186  *
12187  * @since 3.16.0
12188  */
12189 var InsertTextMode;
12190 (function (InsertTextMode) {
12191     /**
12192      * The insertion or replace strings is taken as it is. If the
12193      * value is multi line the lines below the cursor will be
12194      * inserted using the indentation defined in the string value.
12195      * The client will not apply any kind of adjustments to the
12196      * string.
12197      */
12198     InsertTextMode.asIs = 1;
12199     /**
12200      * The editor adjusts leading whitespace of new lines so that
12201      * they match the indentation up to the cursor of the line for
12202      * which the item is accepted.
12203      *
12204      * Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
12205      * multi line completion item is indented using 2 tabs and all
12206      * following lines inserted will be indented using 2 tabs as well.
12207      */
12208     InsertTextMode.adjustIndentation = 2;
12209 })(InsertTextMode || (InsertTextMode = {}));
12210 var CompletionItemLabelDetails;
12211 (function (CompletionItemLabelDetails) {
12212     function is(value) {
12213         const candidate = value;
12214         return candidate && (Is.string(candidate.detail) || candidate.detail === undefined) &&
12215             (Is.string(candidate.description) || candidate.description === undefined);
12216     }
12217     CompletionItemLabelDetails.is = is;
12218 })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {}));
12219 /**
12220  * The CompletionItem namespace provides functions to deal with
12221  * completion items.
12222  */
12223 var CompletionItem;
12224 (function (CompletionItem) {
12225     /**
12226      * Create a completion item and seed it with a label.
12227      * @param label The completion item's label
12228      */
12229     function create(label) {
12230         return { label };
12231     }
12232     CompletionItem.create = create;
12233 })(CompletionItem || (CompletionItem = {}));
12234 /**
12235  * The CompletionList namespace provides functions to deal with
12236  * completion lists.
12237  */
12238 var CompletionList;
12239 (function (CompletionList) {
12240     /**
12241      * Creates a new completion list.
12242      *
12243      * @param items The completion items.
12244      * @param isIncomplete The list is not complete.
12245      */
12246     function create(items, isIncomplete) {
12247         return { items: items ? items : [], isIncomplete: !!isIncomplete };
12248     }
12249     CompletionList.create = create;
12250 })(CompletionList || (CompletionList = {}));
12251 var MarkedString;
12252 (function (MarkedString) {
12253     /**
12254      * Creates a marked string from plain text.
12255      *
12256      * @param plainText The plain text.
12257      */
12258     function fromPlainText(plainText) {
12259         return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
12260     }
12261     MarkedString.fromPlainText = fromPlainText;
12262     /**
12263      * Checks whether the given value conforms to the {@link MarkedString} type.
12264      */
12265     function is(value) {
12266         const candidate = value;
12267         return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
12268     }
12269     MarkedString.is = is;
12270 })(MarkedString || (MarkedString = {}));
12271 var Hover;
12272 (function (Hover) {
12273     /**
12274      * Checks whether the given value conforms to the {@link Hover} interface.
12275      */
12276     function is(value) {
12277         let candidate = value;
12278         return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
12279             MarkedString.is(candidate.contents) ||
12280             Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));
12281     }
12282     Hover.is = is;
12283 })(Hover || (Hover = {}));
12284 /**
12285  * The ParameterInformation namespace provides helper functions to work with
12286  * {@link ParameterInformation} literals.
12287  */
12288 var ParameterInformation;
12289 (function (ParameterInformation) {
12290     /**
12291      * Creates a new parameter information literal.
12292      *
12293      * @param label A label string.
12294      * @param documentation A doc string.
12295      */
12296     function create(label, documentation) {
12297         return documentation ? { label, documentation } : { label };
12298     }
12299     ParameterInformation.create = create;
12300 })(ParameterInformation || (ParameterInformation = {}));
12301 /**
12302  * The SignatureInformation namespace provides helper functions to work with
12303  * {@link SignatureInformation} literals.
12304  */
12305 var SignatureInformation;
12306 (function (SignatureInformation) {
12307     function create(label, documentation, ...parameters) {
12308         let result = { label };
12309         if (Is.defined(documentation)) {
12310             result.documentation = documentation;
12311         }
12312         if (Is.defined(parameters)) {
12313             result.parameters = parameters;
12314         }
12315         else {
12316             result.parameters = [];
12317         }
12318         return result;
12319     }
12320     SignatureInformation.create = create;
12321 })(SignatureInformation || (SignatureInformation = {}));
12322 /**
12323  * A document highlight kind.
12324  */
12325 var DocumentHighlightKind;
12326 (function (DocumentHighlightKind) {
12327     /**
12328      * A textual occurrence.
12329      */
12330     DocumentHighlightKind.Text = 1;
12331     /**
12332      * Read-access of a symbol, like reading a variable.
12333      */
12334     DocumentHighlightKind.Read = 2;
12335     /**
12336      * Write-access of a symbol, like writing to a variable.
12337      */
12338     DocumentHighlightKind.Write = 3;
12339 })(DocumentHighlightKind || (DocumentHighlightKind = {}));
12340 /**
12341  * DocumentHighlight namespace to provide helper functions to work with
12342  * {@link DocumentHighlight} literals.
12343  */
12344 var DocumentHighlight;
12345 (function (DocumentHighlight) {
12346     /**
12347      * Create a DocumentHighlight object.
12348      * @param range The range the highlight applies to.
12349      * @param kind The highlight kind
12350      */
12351     function create(range, kind) {
12352         let result = { range };
12353         if (Is.number(kind)) {
12354             result.kind = kind;
12355         }
12356         return result;
12357     }
12358     DocumentHighlight.create = create;
12359 })(DocumentHighlight || (DocumentHighlight = {}));
12360 /**
12361  * A symbol kind.
12362  */
12363 var SymbolKind;
12364 (function (SymbolKind) {
12365     SymbolKind.File = 1;
12366     SymbolKind.Module = 2;
12367     SymbolKind.Namespace = 3;
12368     SymbolKind.Package = 4;
12369     SymbolKind.Class = 5;
12370     SymbolKind.Method = 6;
12371     SymbolKind.Property = 7;
12372     SymbolKind.Field = 8;
12373     SymbolKind.Constructor = 9;
12374     SymbolKind.Enum = 10;
12375     SymbolKind.Interface = 11;
12376     SymbolKind.Function = 12;
12377     SymbolKind.Variable = 13;
12378     SymbolKind.Constant = 14;
12379     SymbolKind.String = 15;
12380     SymbolKind.Number = 16;
12381     SymbolKind.Boolean = 17;
12382     SymbolKind.Array = 18;
12383     SymbolKind.Object = 19;
12384     SymbolKind.Key = 20;
12385     SymbolKind.Null = 21;
12386     SymbolKind.EnumMember = 22;
12387     SymbolKind.Struct = 23;
12388     SymbolKind.Event = 24;
12389     SymbolKind.Operator = 25;
12390     SymbolKind.TypeParameter = 26;
12391 })(SymbolKind || (SymbolKind = {}));
12392 /**
12393  * Symbol tags are extra annotations that tweak the rendering of a symbol.
12394  *
12395  * @since 3.16
12396  */
12397 var SymbolTag;
12398 (function (SymbolTag) {
12399     /**
12400      * Render a symbol as obsolete, usually using a strike-out.
12401      */
12402     SymbolTag.Deprecated = 1;
12403 })(SymbolTag || (SymbolTag = {}));
12404 var SymbolInformation;
12405 (function (SymbolInformation) {
12406     /**
12407      * Creates a new symbol information literal.
12408      *
12409      * @param name The name of the symbol.
12410      * @param kind The kind of the symbol.
12411      * @param range The range of the location of the symbol.
12412      * @param uri The resource of the location of symbol.
12413      * @param containerName The name of the symbol containing the symbol.
12414      */
12415     function create(name, kind, range, uri, containerName) {
12416         let result = {
12417             name,
12418             kind,
12419             location: { uri, range }
12420         };
12421         if (containerName) {
12422             result.containerName = containerName;
12423         }
12424         return result;
12425     }
12426     SymbolInformation.create = create;
12427 })(SymbolInformation || (SymbolInformation = {}));
12428 var WorkspaceSymbol;
12429 (function (WorkspaceSymbol) {
12430     /**
12431      * Create a new workspace symbol.
12432      *
12433      * @param name The name of the symbol.
12434      * @param kind The kind of the symbol.
12435      * @param uri The resource of the location of the symbol.
12436      * @param range An options range of the location.
12437      * @returns A WorkspaceSymbol.
12438      */
12439     function create(name, kind, uri, range) {
12440         return range !== undefined
12441             ? { name, kind, location: { uri, range } }
12442             : { name, kind, location: { uri } };
12443     }
12444     WorkspaceSymbol.create = create;
12445 })(WorkspaceSymbol || (WorkspaceSymbol = {}));
12446 var DocumentSymbol;
12447 (function (DocumentSymbol) {
12448     /**
12449      * Creates a new symbol information literal.
12450      *
12451      * @param name The name of the symbol.
12452      * @param detail The detail of the symbol.
12453      * @param kind The kind of the symbol.
12454      * @param range The range of the symbol.
12455      * @param selectionRange The selectionRange of the symbol.
12456      * @param children Children of the symbol.
12457      */
12458     function create(name, detail, kind, range, selectionRange, children) {
12459         let result = {
12460             name,
12461             detail,
12462             kind,
12463             range,
12464             selectionRange
12465         };
12466         if (children !== undefined) {
12467             result.children = children;
12468         }
12469         return result;
12470     }
12471     DocumentSymbol.create = create;
12472     /**
12473      * Checks whether the given literal conforms to the {@link DocumentSymbol} interface.
12474      */
12475     function is(value) {
12476         let candidate = value;
12477         return candidate &&
12478             Is.string(candidate.name) && Is.number(candidate.kind) &&
12479             Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
12480             (candidate.detail === undefined || Is.string(candidate.detail)) &&
12481             (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&
12482             (candidate.children === undefined || Array.isArray(candidate.children)) &&
12483             (candidate.tags === undefined || Array.isArray(candidate.tags));
12484     }
12485     DocumentSymbol.is = is;
12486 })(DocumentSymbol || (DocumentSymbol = {}));
12487 /**
12488  * A set of predefined code action kinds
12489  */
12490 var CodeActionKind;
12491 (function (CodeActionKind) {
12492     /**
12493      * Empty kind.
12494      */
12495     CodeActionKind.Empty = '';
12496     /**
12497      * Base kind for quickfix actions: 'quickfix'
12498      */
12499     CodeActionKind.QuickFix = 'quickfix';
12500     /**
12501      * Base kind for refactoring actions: 'refactor'
12502      */
12503     CodeActionKind.Refactor = 'refactor';
12504     /**
12505      * Base kind for refactoring extraction actions: 'refactor.extract'
12506      *
12507      * Example extract actions:
12508      *
12509      * - Extract method
12510      * - Extract function
12511      * - Extract variable
12512      * - Extract interface from class
12513      * - ...
12514      */
12515     CodeActionKind.RefactorExtract = 'refactor.extract';
12516     /**
12517      * Base kind for refactoring inline actions: 'refactor.inline'
12518      *
12519      * Example inline actions:
12520      *
12521      * - Inline function
12522      * - Inline variable
12523      * - Inline constant
12524      * - ...
12525      */
12526     CodeActionKind.RefactorInline = 'refactor.inline';
12527     /**
12528      * Base kind for refactoring rewrite actions: 'refactor.rewrite'
12529      *
12530      * Example rewrite actions:
12531      *
12532      * - Convert JavaScript function to class
12533      * - Add or remove parameter
12534      * - Encapsulate field
12535      * - Make method static
12536      * - Move method to base class
12537      * - ...
12538      */
12539     CodeActionKind.RefactorRewrite = 'refactor.rewrite';
12540     /**
12541      * Base kind for source actions: `source`
12542      *
12543      * Source code actions apply to the entire file.
12544      */
12545     CodeActionKind.Source = 'source';
12546     /**
12547      * Base kind for an organize imports source action: `source.organizeImports`
12548      */
12549     CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
12550     /**
12551      * Base kind for auto-fix source actions: `source.fixAll`.
12552      *
12553      * Fix all actions automatically fix errors that have a clear fix that do not require user input.
12554      * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
12555      *
12556      * @since 3.15.0
12557      */
12558     CodeActionKind.SourceFixAll = 'source.fixAll';
12559 })(CodeActionKind || (CodeActionKind = {}));
12560 /**
12561  * The reason why code actions were requested.
12562  *
12563  * @since 3.17.0
12564  */
12565 var CodeActionTriggerKind;
12566 (function (CodeActionTriggerKind) {
12567     /**
12568      * Code actions were explicitly requested by the user or by an extension.
12569      */
12570     CodeActionTriggerKind.Invoked = 1;
12571     /**
12572      * Code actions were requested automatically.
12573      *
12574      * This typically happens when current selection in a file changes, but can
12575      * also be triggered when file content changes.
12576      */
12577     CodeActionTriggerKind.Automatic = 2;
12578 })(CodeActionTriggerKind || (CodeActionTriggerKind = {}));
12579 /**
12580  * The CodeActionContext namespace provides helper functions to work with
12581  * {@link CodeActionContext} literals.
12582  */
12583 var CodeActionContext;
12584 (function (CodeActionContext) {
12585     /**
12586      * Creates a new CodeActionContext literal.
12587      */
12588     function create(diagnostics, only, triggerKind) {
12589         let result = { diagnostics };
12590         if (only !== undefined && only !== null) {
12591             result.only = only;
12592         }
12593         if (triggerKind !== undefined && triggerKind !== null) {
12594             result.triggerKind = triggerKind;
12595         }
12596         return result;
12597     }
12598     CodeActionContext.create = create;
12599     /**
12600      * Checks whether the given literal conforms to the {@link CodeActionContext} interface.
12601      */
12602     function is(value) {
12603         let candidate = value;
12604         return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is)
12605             && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string))
12606             && (candidate.triggerKind === undefined || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic);
12607     }
12608     CodeActionContext.is = is;
12609 })(CodeActionContext || (CodeActionContext = {}));
12610 var CodeAction;
12611 (function (CodeAction) {
12612     function create(title, kindOrCommandOrEdit, kind) {
12613         let result = { title };
12614         let checkKind = true;
12615         if (typeof kindOrCommandOrEdit === 'string') {
12616             checkKind = false;
12617             result.kind = kindOrCommandOrEdit;
12618         }
12619         else if (Command.is(kindOrCommandOrEdit)) {
12620             result.command = kindOrCommandOrEdit;
12621         }
12622         else {
12623             result.edit = kindOrCommandOrEdit;
12624         }
12625         if (checkKind && kind !== undefined) {
12626             result.kind = kind;
12627         }
12628         return result;
12629     }
12630     CodeAction.create = create;
12631     function is(value) {
12632         let candidate = value;
12633         return candidate && Is.string(candidate.title) &&
12634             (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
12635             (candidate.kind === undefined || Is.string(candidate.kind)) &&
12636             (candidate.edit !== undefined || candidate.command !== undefined) &&
12637             (candidate.command === undefined || Command.is(candidate.command)) &&
12638             (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&
12639             (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));
12640     }
12641     CodeAction.is = is;
12642 })(CodeAction || (CodeAction = {}));
12643 /**
12644  * The CodeLens namespace provides helper functions to work with
12645  * {@link CodeLens} literals.
12646  */
12647 var CodeLens;
12648 (function (CodeLens) {
12649     /**
12650      * Creates a new CodeLens literal.
12651      */
12652     function create(range, data) {
12653         let result = { range };
12654         if (Is.defined(data)) {
12655             result.data = data;
12656         }
12657         return result;
12658     }
12659     CodeLens.create = create;
12660     /**
12661      * Checks whether the given literal conforms to the {@link CodeLens} interface.
12662      */
12663     function is(value) {
12664         let candidate = value;
12665         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
12666     }
12667     CodeLens.is = is;
12668 })(CodeLens || (CodeLens = {}));
12669 /**
12670  * The FormattingOptions namespace provides helper functions to work with
12671  * {@link FormattingOptions} literals.
12672  */
12673 var FormattingOptions;
12674 (function (FormattingOptions) {
12675     /**
12676      * Creates a new FormattingOptions literal.
12677      */
12678     function create(tabSize, insertSpaces) {
12679         return { tabSize, insertSpaces };
12680     }
12681     FormattingOptions.create = create;
12682     /**
12683      * Checks whether the given literal conforms to the {@link FormattingOptions} interface.
12684      */
12685     function is(value) {
12686         let candidate = value;
12687         return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
12688     }
12689     FormattingOptions.is = is;
12690 })(FormattingOptions || (FormattingOptions = {}));
12691 /**
12692  * The DocumentLink namespace provides helper functions to work with
12693  * {@link DocumentLink} literals.
12694  */
12695 var DocumentLink;
12696 (function (DocumentLink) {
12697     /**
12698      * Creates a new DocumentLink literal.
12699      */
12700     function create(range, target, data) {
12701         return { range, target, data };
12702     }
12703     DocumentLink.create = create;
12704     /**
12705      * Checks whether the given literal conforms to the {@link DocumentLink} interface.
12706      */
12707     function is(value) {
12708         let candidate = value;
12709         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
12710     }
12711     DocumentLink.is = is;
12712 })(DocumentLink || (DocumentLink = {}));
12713 /**
12714  * The SelectionRange namespace provides helper function to work with
12715  * SelectionRange literals.
12716  */
12717 var SelectionRange;
12718 (function (SelectionRange) {
12719     /**
12720      * Creates a new SelectionRange
12721      * @param range the range.
12722      * @param parent an optional parent.
12723      */
12724     function create(range, parent) {
12725         return { range, parent };
12726     }
12727     SelectionRange.create = create;
12728     function is(value) {
12729         let candidate = value;
12730         return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
12731     }
12732     SelectionRange.is = is;
12733 })(SelectionRange || (SelectionRange = {}));
12734 /**
12735  * A set of predefined token types. This set is not fixed
12736  * an clients can specify additional token types via the
12737  * corresponding client capabilities.
12738  *
12739  * @since 3.16.0
12740  */
12741 var SemanticTokenTypes;
12742 (function (SemanticTokenTypes) {
12743     SemanticTokenTypes["namespace"] = "namespace";
12744     /**
12745      * Represents a generic type. Acts as a fallback for types which can't be mapped to
12746      * a specific type like class or enum.
12747      */
12748     SemanticTokenTypes["type"] = "type";
12749     SemanticTokenTypes["class"] = "class";
12750     SemanticTokenTypes["enum"] = "enum";
12751     SemanticTokenTypes["interface"] = "interface";
12752     SemanticTokenTypes["struct"] = "struct";
12753     SemanticTokenTypes["typeParameter"] = "typeParameter";
12754     SemanticTokenTypes["parameter"] = "parameter";
12755     SemanticTokenTypes["variable"] = "variable";
12756     SemanticTokenTypes["property"] = "property";
12757     SemanticTokenTypes["enumMember"] = "enumMember";
12758     SemanticTokenTypes["event"] = "event";
12759     SemanticTokenTypes["function"] = "function";
12760     SemanticTokenTypes["method"] = "method";
12761     SemanticTokenTypes["macro"] = "macro";
12762     SemanticTokenTypes["keyword"] = "keyword";
12763     SemanticTokenTypes["modifier"] = "modifier";
12764     SemanticTokenTypes["comment"] = "comment";
12765     SemanticTokenTypes["string"] = "string";
12766     SemanticTokenTypes["number"] = "number";
12767     SemanticTokenTypes["regexp"] = "regexp";
12768     SemanticTokenTypes["operator"] = "operator";
12769     /**
12770      * @since 3.17.0
12771      */
12772     SemanticTokenTypes["decorator"] = "decorator";
12773 })(SemanticTokenTypes || (SemanticTokenTypes = {}));
12774 /**
12775  * A set of predefined token modifiers. This set is not fixed
12776  * an clients can specify additional token types via the
12777  * corresponding client capabilities.
12778  *
12779  * @since 3.16.0
12780  */
12781 var SemanticTokenModifiers;
12782 (function (SemanticTokenModifiers) {
12783     SemanticTokenModifiers["declaration"] = "declaration";
12784     SemanticTokenModifiers["definition"] = "definition";
12785     SemanticTokenModifiers["readonly"] = "readonly";
12786     SemanticTokenModifiers["static"] = "static";
12787     SemanticTokenModifiers["deprecated"] = "deprecated";
12788     SemanticTokenModifiers["abstract"] = "abstract";
12789     SemanticTokenModifiers["async"] = "async";
12790     SemanticTokenModifiers["modification"] = "modification";
12791     SemanticTokenModifiers["documentation"] = "documentation";
12792     SemanticTokenModifiers["defaultLibrary"] = "defaultLibrary";
12793 })(SemanticTokenModifiers || (SemanticTokenModifiers = {}));
12794 /**
12795  * @since 3.16.0
12796  */
12797 var SemanticTokens;
12798 (function (SemanticTokens) {
12799     function is(value) {
12800         const candidate = value;
12801         return Is.objectLiteral(candidate) && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&
12802             Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');
12803     }
12804     SemanticTokens.is = is;
12805 })(SemanticTokens || (SemanticTokens = {}));
12806 /**
12807  * The InlineValueText namespace provides functions to deal with InlineValueTexts.
12808  *
12809  * @since 3.17.0
12810  */
12811 var InlineValueText;
12812 (function (InlineValueText) {
12813     /**
12814      * Creates a new InlineValueText literal.
12815      */
12816     function create(range, text) {
12817         return { range, text };
12818     }
12819     InlineValueText.create = create;
12820     function is(value) {
12821         const candidate = value;
12822         return candidate !== undefined && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text);
12823     }
12824     InlineValueText.is = is;
12825 })(InlineValueText || (InlineValueText = {}));
12826 /**
12827  * The InlineValueVariableLookup namespace provides functions to deal with InlineValueVariableLookups.
12828  *
12829  * @since 3.17.0
12830  */
12831 var InlineValueVariableLookup;
12832 (function (InlineValueVariableLookup) {
12833     /**
12834      * Creates a new InlineValueText literal.
12835      */
12836     function create(range, variableName, caseSensitiveLookup) {
12837         return { range, variableName, caseSensitiveLookup };
12838     }
12839     InlineValueVariableLookup.create = create;
12840     function is(value) {
12841         const candidate = value;
12842         return candidate !== undefined && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup)
12843             && (Is.string(candidate.variableName) || candidate.variableName === undefined);
12844     }
12845     InlineValueVariableLookup.is = is;
12846 })(InlineValueVariableLookup || (InlineValueVariableLookup = {}));
12847 /**
12848  * The InlineValueEvaluatableExpression namespace provides functions to deal with InlineValueEvaluatableExpression.
12849  *
12850  * @since 3.17.0
12851  */
12852 var InlineValueEvaluatableExpression;
12853 (function (InlineValueEvaluatableExpression) {
12854     /**
12855      * Creates a new InlineValueEvaluatableExpression literal.
12856      */
12857     function create(range, expression) {
12858         return { range, expression };
12859     }
12860     InlineValueEvaluatableExpression.create = create;
12861     function is(value) {
12862         const candidate = value;
12863         return candidate !== undefined && candidate !== null && Range.is(candidate.range)
12864             && (Is.string(candidate.expression) || candidate.expression === undefined);
12865     }
12866     InlineValueEvaluatableExpression.is = is;
12867 })(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {}));
12868 /**
12869  * The InlineValueContext namespace provides helper functions to work with
12870  * {@link InlineValueContext} literals.
12871  *
12872  * @since 3.17.0
12873  */
12874 var InlineValueContext;
12875 (function (InlineValueContext) {
12876     /**
12877      * Creates a new InlineValueContext literal.
12878      */
12879     function create(frameId, stoppedLocation) {
12880         return { frameId, stoppedLocation };
12881     }
12882     InlineValueContext.create = create;
12883     /**
12884      * Checks whether the given literal conforms to the {@link InlineValueContext} interface.
12885      */
12886     function is(value) {
12887         const candidate = value;
12888         return Is.defined(candidate) && Range.is(value.stoppedLocation);
12889     }
12890     InlineValueContext.is = is;
12891 })(InlineValueContext || (InlineValueContext = {}));
12892 /**
12893  * Inlay hint kinds.
12894  *
12895  * @since 3.17.0
12896  */
12897 var InlayHintKind;
12898 (function (InlayHintKind) {
12899     /**
12900      * An inlay hint that for a type annotation.
12901      */
12902     InlayHintKind.Type = 1;
12903     /**
12904      * An inlay hint that is for a parameter.
12905      */
12906     InlayHintKind.Parameter = 2;
12907     function is(value) {
12908         return value === 1 || value === 2;
12909     }
12910     InlayHintKind.is = is;
12911 })(InlayHintKind || (InlayHintKind = {}));
12912 var InlayHintLabelPart;
12913 (function (InlayHintLabelPart) {
12914     function create(value) {
12915         return { value };
12916     }
12917     InlayHintLabelPart.create = create;
12918     function is(value) {
12919         const candidate = value;
12920         return Is.objectLiteral(candidate)
12921             && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip))
12922             && (candidate.location === undefined || Location.is(candidate.location))
12923             && (candidate.command === undefined || Command.is(candidate.command));
12924     }
12925     InlayHintLabelPart.is = is;
12926 })(InlayHintLabelPart || (InlayHintLabelPart = {}));
12927 var InlayHint;
12928 (function (InlayHint) {
12929     function create(position, label, kind) {
12930         const result = { position, label };
12931         if (kind !== undefined) {
12932             result.kind = kind;
12933         }
12934         return result;
12935     }
12936     InlayHint.create = create;
12937     function is(value) {
12938         const candidate = value;
12939         return Is.objectLiteral(candidate) && Position.is(candidate.position)
12940             && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is))
12941             && (candidate.kind === undefined || InlayHintKind.is(candidate.kind))
12942             && (candidate.textEdits === undefined) || Is.typedArray(candidate.textEdits, TextEdit.is)
12943             && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip))
12944             && (candidate.paddingLeft === undefined || Is.boolean(candidate.paddingLeft))
12945             && (candidate.paddingRight === undefined || Is.boolean(candidate.paddingRight));
12946     }
12947     InlayHint.is = is;
12948 })(InlayHint || (InlayHint = {}));
12949 var StringValue;
12950 (function (StringValue) {
12951     function createSnippet(value) {
12952         return { kind: 'snippet', value };
12953     }
12954     StringValue.createSnippet = createSnippet;
12955 })(StringValue || (StringValue = {}));
12956 var InlineCompletionItem;
12957 (function (InlineCompletionItem) {
12958     function create(insertText, filterText, range, command) {
12959         return { insertText, filterText, range, command };
12960     }
12961     InlineCompletionItem.create = create;
12962 })(InlineCompletionItem || (InlineCompletionItem = {}));
12963 var InlineCompletionList;
12964 (function (InlineCompletionList) {
12965     function create(items) {
12966         return { items };
12967     }
12968     InlineCompletionList.create = create;
12969 })(InlineCompletionList || (InlineCompletionList = {}));
12970 /**
12971  * Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
12972  *
12973  * @since 3.18.0
12974  * @proposed
12975  */
12976 var InlineCompletionTriggerKind;
12977 (function (InlineCompletionTriggerKind) {
12978     /**
12979      * Completion was triggered explicitly by a user gesture.
12980      */
12981     InlineCompletionTriggerKind.Invoked = 0;
12982     /**
12983      * Completion was triggered automatically while editing.
12984      */
12985     InlineCompletionTriggerKind.Automatic = 1;
12986 })(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));
12987 var SelectedCompletionInfo;
12988 (function (SelectedCompletionInfo) {
12989     function create(range, text) {
12990         return { range, text };
12991     }
12992     SelectedCompletionInfo.create = create;
12993 })(SelectedCompletionInfo || (SelectedCompletionInfo = {}));
12994 var InlineCompletionContext;
12995 (function (InlineCompletionContext) {
12996     function create(triggerKind, selectedCompletionInfo) {
12997         return { triggerKind, selectedCompletionInfo };
12998     }
12999     InlineCompletionContext.create = create;
13000 })(InlineCompletionContext || (InlineCompletionContext = {}));
13001 var WorkspaceFolder;
13002 (function (WorkspaceFolder) {
13003     function is(value) {
13004         const candidate = value;
13005         return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name);
13006     }
13007     WorkspaceFolder.is = is;
13008 })(WorkspaceFolder || (WorkspaceFolder = {}));
13009 const EOL = (/* unused pure expression or super */ null && (['\n', '\r\n', '\r']));
13010 /**
13011  * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
13012  */
13013 var TextDocument;
13014 (function (TextDocument) {
13015     /**
13016      * Creates a new ITextDocument literal from the given uri and content.
13017      * @param uri The document's uri.
13018      * @param languageId The document's language Id.
13019      * @param version The document's version.
13020      * @param content The document's content.
13021      */
13022     function create(uri, languageId, version, content) {
13023         return new FullTextDocument(uri, languageId, version, content);
13024     }
13025     TextDocument.create = create;
13026     /**
13027      * Checks whether the given literal conforms to the {@link ITextDocument} interface.
13028      */
13029     function is(value) {
13030         let candidate = value;
13031         return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)
13032             && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
13033     }
13034     TextDocument.is = is;
13035     function applyEdits(document, edits) {
13036         let text = document.getText();
13037         let sortedEdits = mergeSort(edits, (a, b) => {
13038             let diff = a.range.start.line - b.range.start.line;
13039             if (diff === 0) {
13040                 return a.range.start.character - b.range.start.character;
13041             }
13042             return diff;
13043         });
13044         let lastModifiedOffset = text.length;
13045         for (let i = sortedEdits.length - 1; i >= 0; i--) {
13046             let e = sortedEdits[i];
13047             let startOffset = document.offsetAt(e.range.start);
13048             let endOffset = document.offsetAt(e.range.end);
13049             if (endOffset <= lastModifiedOffset) {
13050                 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
13051             }
13052             else {
13053                 throw new Error('Overlapping edit');
13054             }
13055             lastModifiedOffset = startOffset;
13056         }
13057         return text;
13058     }
13059     TextDocument.applyEdits = applyEdits;
13060     function mergeSort(data, compare) {
13061         if (data.length <= 1) {
13062             // sorted
13063             return data;
13064         }
13065         const p = (data.length / 2) | 0;
13066         const left = data.slice(0, p);
13067         const right = data.slice(p);
13068         mergeSort(left, compare);
13069         mergeSort(right, compare);
13070         let leftIdx = 0;
13071         let rightIdx = 0;
13072         let i = 0;
13073         while (leftIdx < left.length && rightIdx < right.length) {
13074             let ret = compare(left[leftIdx], right[rightIdx]);
13075             if (ret <= 0) {
13076                 // smaller_equal -> take left to preserve order
13077                 data[i++] = left[leftIdx++];
13078             }
13079             else {
13080                 // greater -> take right
13081                 data[i++] = right[rightIdx++];
13082             }
13083         }
13084         while (leftIdx < left.length) {
13085             data[i++] = left[leftIdx++];
13086         }
13087         while (rightIdx < right.length) {
13088             data[i++] = right[rightIdx++];
13089         }
13090         return data;
13091     }
13092 })(TextDocument || (TextDocument = {}));
13093 /**
13094  * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
13095  */
13096 class FullTextDocument {
13097     constructor(uri, languageId, version, content) {
13098         this._uri = uri;
13099         this._languageId = languageId;
13100         this._version = version;
13101         this._content = content;
13102         this._lineOffsets = undefined;
13103     }
13104     get uri() {
13105         return this._uri;
13106     }
13107     get languageId() {
13108         return this._languageId;
13109     }
13110     get version() {
13111         return this._version;
13112     }
13113     getText(range) {
13114         if (range) {
13115             let start = this.offsetAt(range.start);
13116             let end = this.offsetAt(range.end);
13117             return this._content.substring(start, end);
13118         }
13119         return this._content;
13120     }
13121     update(event, version) {
13122         this._content = event.text;
13123         this._version = version;
13124         this._lineOffsets = undefined;
13125     }
13126     getLineOffsets() {
13127         if (this._lineOffsets === undefined) {
13128             let lineOffsets = [];
13129             let text = this._content;
13130             let isLineStart = true;
13131             for (let i = 0; i < text.length; i++) {
13132                 if (isLineStart) {
13133                     lineOffsets.push(i);
13134                     isLineStart = false;
13135                 }
13136                 let ch = text.charAt(i);
13137                 isLineStart = (ch === '\r' || ch === '\n');
13138                 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
13139                     i++;
13140                 }
13141             }
13142             if (isLineStart && text.length > 0) {
13143                 lineOffsets.push(text.length);
13144             }
13145             this._lineOffsets = lineOffsets;
13146         }
13147         return this._lineOffsets;
13148     }
13149     positionAt(offset) {
13150         offset = Math.max(Math.min(offset, this._content.length), 0);
13151         let lineOffsets = this.getLineOffsets();
13152         let low = 0, high = lineOffsets.length;
13153         if (high === 0) {
13154             return Position.create(0, offset);
13155         }
13156         while (low < high) {
13157             let mid = Math.floor((low + high) / 2);
13158             if (lineOffsets[mid] > offset) {
13159                 high = mid;
13160             }
13161             else {
13162                 low = mid + 1;
13163             }
13164         }
13165         // low is the least x for which the line offset is larger than the current offset
13166         // or array.length if no line offset is larger than the current offset
13167         let line = low - 1;
13168         return Position.create(line, offset - lineOffsets[line]);
13169     }
13170     offsetAt(position) {
13171         let lineOffsets = this.getLineOffsets();
13172         if (position.line >= lineOffsets.length) {
13173             return this._content.length;
13174         }
13175         else if (position.line < 0) {
13176             return 0;
13177         }
13178         let lineOffset = lineOffsets[position.line];
13179         let nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
13180         return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
13181     }
13182     get lineCount() {
13183         return this.getLineOffsets().length;
13184     }
13185 }
13186 var Is;
13187 (function (Is) {
13188     const toString = Object.prototype.toString;
13189     function defined(value) {
13190         return typeof value !== 'undefined';
13191     }
13192     Is.defined = defined;
13193     function undefined(value) {
13194         return typeof value === 'undefined';
13195     }
13196     Is.undefined = undefined;
13197     function boolean(value) {
13198         return value === true || value === false;
13199     }
13200     Is.boolean = boolean;
13201     function string(value) {
13202         return toString.call(value) === '[object String]';
13203     }
13204     Is.string = string;
13205     function number(value) {
13206         return toString.call(value) === '[object Number]';
13207     }
13208     Is.number = number;
13209     function numberRange(value, min, max) {
13210         return toString.call(value) === '[object Number]' && min <= value && value <= max;
13211     }
13212     Is.numberRange = numberRange;
13213     function integer(value) {
13214         return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;
13215     }
13216     Is.integer = integer;
13217     function uinteger(value) {
13218         return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;
13219     }
13220     Is.uinteger = uinteger;
13221     function func(value) {
13222         return toString.call(value) === '[object Function]';
13223     }
13224     Is.func = func;
13225     function objectLiteral(value) {
13226         // Strictly speaking class instances pass this check as well. Since the LSP
13227         // doesn't use classes we ignore this for now. If we do we need to add something
13228         // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
13229         return value !== null && typeof value === 'object';
13230     }
13231     Is.objectLiteral = objectLiteral;
13232     function typedArray(value, check) {
13233         return Array.isArray(value) && value.every(check);
13234     }
13235     Is.typedArray = typedArray;
13236 })(Is || (Is = {}));
13237 
13238 ;// CONCATENATED MODULE: ../node_modules/langium/lib/parser/cst-node-builder.js
13239 /******************************************************************************
13240  * Copyright 2021 TypeFox GmbH
13241  * This program and the accompanying materials are made available under the
13242  * terms of the MIT License, which is available in the project root.
13243  ******************************************************************************/
13244 
13245 
13246 class CstNodeBuilder {
13247     constructor() {
13248         this.nodeStack = [];
13249     }
13250     get current() {
13251         var _a;
13252         return (_a = this.nodeStack[this.nodeStack.length - 1]) !== null && _a !== void 0 ? _a : this.rootNode;
13253     }
13254     buildRootNode(input) {
13255         this.rootNode = new RootCstNodeImpl(input);
13256         this.rootNode.root = this.rootNode;
13257         this.nodeStack = [this.rootNode];
13258         return this.rootNode;
13259     }
13260     buildCompositeNode(feature) {
13261         const compositeNode = new CompositeCstNodeImpl();
13262         compositeNode.grammarSource = feature;
13263         compositeNode.root = this.rootNode;
13264         this.current.content.push(compositeNode);
13265         this.nodeStack.push(compositeNode);
13266         return compositeNode;
13267     }
13268     buildLeafNode(token, feature) {
13269         const leafNode = new LeafCstNodeImpl(token.startOffset, token.image.length, (0,cst_utils/* tokenToRange */.sp)(token), token.tokenType, !feature);
13270         leafNode.grammarSource = feature;
13271         leafNode.root = this.rootNode;
13272         this.current.content.push(leafNode);
13273         return leafNode;
13274     }
13275     removeNode(node) {
13276         const parent = node.container;
13277         if (parent) {
13278             const index = parent.content.indexOf(node);
13279             if (index >= 0) {
13280                 parent.content.splice(index, 1);
13281             }
13282         }
13283     }
13284     addHiddenNodes(tokens) {
13285         const nodes = [];
13286         for (const token of tokens) {
13287             const leafNode = new LeafCstNodeImpl(token.startOffset, token.image.length, (0,cst_utils/* tokenToRange */.sp)(token), token.tokenType, true);
13288             leafNode.root = this.rootNode;
13289             nodes.push(leafNode);
13290         }
13291         let current = this.current;
13292         let added = false;
13293         // If we are within a composite node, we add the hidden nodes to the content
13294         if (current.content.length > 0) {
13295             current.content.push(...nodes);
13296             return;
13297         }
13298         // Otherwise we are at a newly created node
13299         // Instead of adding the hidden nodes here, we search for the first parent node with content
13300         while (current.container) {
13301             const index = current.container.content.indexOf(current);
13302             if (index > 0) {
13303                 // Add the hidden nodes before the current node
13304                 current.container.content.splice(index, 0, ...nodes);
13305                 added = true;
13306                 break;
13307             }
13308             current = current.container;
13309         }
13310         // If we arrive at the root node, we add the hidden nodes at the beginning
13311         // This is the case if the hidden nodes are the first nodes in the tree
13312         if (!added) {
13313             this.rootNode.content.unshift(...nodes);
13314         }
13315     }
13316     construct(item) {
13317         const current = this.current;
13318         // The specified item could be a datatype ($type is symbol) or a fragment ($type is undefined)
13319         // Only if the $type is a string, we actually assign the element
13320         if (typeof item.$type === 'string') {
13321             this.current.astNode = item;
13322         }
13323         item.$cstNode = current;
13324         const node = this.nodeStack.pop();
13325         // Empty composite nodes are not valid
13326         // Simply remove the node from the tree
13327         if ((node === null || node === void 0 ? void 0 : node.content.length) === 0) {
13328             this.removeNode(node);
13329         }
13330     }
13331 }
13332 class AbstractCstNode {
13333     /** @deprecated use `container` instead. */
13334     get parent() {
13335         return this.container;
13336     }
13337     /** @deprecated use `grammarSource` instead. */
13338     get feature() {
13339         return this.grammarSource;
13340     }
13341     get hidden() {
13342         return false;
13343     }
13344     get astNode() {
13345         var _a, _b;
13346         const node = typeof ((_a = this._astNode) === null || _a === void 0 ? void 0 : _a.$type) === 'string' ? this._astNode : (_b = this.container) === null || _b === void 0 ? void 0 : _b.astNode;
13347         if (!node) {
13348             throw new Error('This node has no associated AST element');
13349         }
13350         return node;
13351     }
13352     set astNode(value) {
13353         this._astNode = value;
13354     }
13355     /** @deprecated use `astNode` instead. */
13356     get element() {
13357         return this.astNode;
13358     }
13359     get text() {
13360         return this.root.fullText.substring(this.offset, this.end);
13361     }
13362 }
13363 class LeafCstNodeImpl extends AbstractCstNode {
13364     get offset() {
13365         return this._offset;
13366     }
13367     get length() {
13368         return this._length;
13369     }
13370     get end() {
13371         return this._offset + this._length;
13372     }
13373     get hidden() {
13374         return this._hidden;
13375     }
13376     get tokenType() {
13377         return this._tokenType;
13378     }
13379     get range() {
13380         return this._range;
13381     }
13382     constructor(offset, length, range, tokenType, hidden = false) {
13383         super();
13384         this._hidden = hidden;
13385         this._offset = offset;
13386         this._tokenType = tokenType;
13387         this._length = length;
13388         this._range = range;
13389     }
13390 }
13391 class CompositeCstNodeImpl extends AbstractCstNode {
13392     constructor() {
13393         super(...arguments);
13394         this.content = new CstNodeContainer(this);
13395     }
13396     /** @deprecated use `content` instead. */
13397     get children() {
13398         return this.content;
13399     }
13400     get offset() {
13401         var _a, _b;
13402         return (_b = (_a = this.firstNonHiddenNode) === null || _a === void 0 ? void 0 : _a.offset) !== null && _b !== void 0 ? _b : 0;
13403     }
13404     get length() {
13405         return this.end - this.offset;
13406     }
13407     get end() {
13408         var _a, _b;
13409         return (_b = (_a = this.lastNonHiddenNode) === null || _a === void 0 ? void 0 : _a.end) !== null && _b !== void 0 ? _b : 0;
13410     }
13411     get range() {
13412         const firstNode = this.firstNonHiddenNode;
13413         const lastNode = this.lastNonHiddenNode;
13414         if (firstNode && lastNode) {
13415             if (this._rangeCache === undefined) {
13416                 const { range: firstRange } = firstNode;
13417                 const { range: lastRange } = lastNode;
13418                 this._rangeCache = { start: firstRange.start, end: lastRange.end.line < firstRange.start.line ? firstRange.start : lastRange.end };
13419             }
13420             return this._rangeCache;
13421         }
13422         else {
13423             return { start: Position.create(0, 0), end: Position.create(0, 0) };
13424         }
13425     }
13426     get firstNonHiddenNode() {
13427         for (const child of this.content) {
13428             if (!child.hidden) {
13429                 return child;
13430             }
13431         }
13432         return this.content[0];
13433     }
13434     get lastNonHiddenNode() {
13435         for (let i = this.content.length - 1; i >= 0; i--) {
13436             const child = this.content[i];
13437             if (!child.hidden) {
13438                 return child;
13439             }
13440         }
13441         return this.content[this.content.length - 1];
13442     }
13443 }
13444 class CstNodeContainer extends Array {
13445     constructor(parent) {
13446         super();
13447         this.parent = parent;
13448         Object.setPrototypeOf(this, CstNodeContainer.prototype);
13449     }
13450     push(...items) {
13451         this.addParents(items);
13452         return super.push(...items);
13453     }
13454     unshift(...items) {
13455         this.addParents(items);
13456         return super.unshift(...items);
13457     }
13458     splice(start, count, ...items) {
13459         this.addParents(items);
13460         return super.splice(start, count, ...items);
13461     }
13462     addParents(items) {
13463         for (const item of items) {
13464             item.container = this.parent;
13465         }
13466     }
13467 }
13468 class RootCstNodeImpl extends CompositeCstNodeImpl {
13469     get text() {
13470         return this._text.substring(this.offset, this.end);
13471     }
13472     get fullText() {
13473         return this._text;
13474     }
13475     constructor(input) {
13476         super();
13477         this._text = '';
13478         this._text = input !== null && input !== void 0 ? input : '';
13479     }
13480 }
13481 //# sourceMappingURL=cst-node-builder.js.map
13482 ;// CONCATENATED MODULE: ../node_modules/langium/lib/parser/langium-parser.js
13483 /******************************************************************************
13484  * Copyright 2021 TypeFox GmbH
13485  * This program and the accompanying materials are made available under the
13486  * terms of the MIT License, which is available in the project root.
13487  ******************************************************************************/
13488 
13489 
13490 
13491 
13492 
13493 
13494 const DatatypeSymbol = Symbol('Datatype');
13495 function isDataTypeNode(node) {
13496     return node.$type === DatatypeSymbol;
13497 }
13498 const ruleSuffix = '\u200B';
13499 const withRuleSuffix = (name) => name.endsWith(ruleSuffix) ? name : name + ruleSuffix;
13500 class AbstractLangiumParser {
13501     constructor(services) {
13502         this._unorderedGroups = new Map();
13503         this.allRules = new Map();
13504         this.lexer = services.parser.Lexer;
13505         const tokens = this.lexer.definition;
13506         const production = services.LanguageMetaData.mode === 'production';
13507         this.wrapper = new ChevrotainWrapper(tokens, Object.assign(Object.assign({}, services.parser.ParserConfig), { skipValidations: production, errorMessageProvider: services.parser.ParserErrorMessageProvider }));
13508     }
13509     alternatives(idx, choices) {
13510         this.wrapper.wrapOr(idx, choices);
13511     }
13512     optional(idx, callback) {
13513         this.wrapper.wrapOption(idx, callback);
13514     }
13515     many(idx, callback) {
13516         this.wrapper.wrapMany(idx, callback);
13517     }
13518     atLeastOne(idx, callback) {
13519         this.wrapper.wrapAtLeastOne(idx, callback);
13520     }
13521     getRule(name) {
13522         return this.allRules.get(name);
13523     }
13524     isRecording() {
13525         return this.wrapper.IS_RECORDING;
13526     }
13527     get unorderedGroups() {
13528         return this._unorderedGroups;
13529     }
13530     getRuleStack() {
13531         return this.wrapper.RULE_STACK;
13532     }
13533     finalize() {
13534         this.wrapper.wrapSelfAnalysis();
13535     }
13536 }
13537 class LangiumParser extends AbstractLangiumParser {
13538     get current() {
13539         return this.stack[this.stack.length - 1];
13540     }
13541     constructor(services) {
13542         super(services);
13543         this.nodeBuilder = new CstNodeBuilder();
13544         this.stack = [];
13545         this.assignmentMap = new Map();
13546         this.linker = services.references.Linker;
13547         this.converter = services.parser.ValueConverter;
13548         this.astReflection = services.shared.AstReflection;
13549     }
13550     rule(rule, impl) {
13551         const type = this.computeRuleType(rule);
13552         const ruleMethod = this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name), this.startImplementation(type, impl).bind(this));
13553         this.allRules.set(rule.name, ruleMethod);
13554         if (rule.entry) {
13555             this.mainRule = ruleMethod;
13556         }
13557         return ruleMethod;
13558     }
13559     computeRuleType(rule) {
13560         if (rule.fragment) {
13561             return undefined;
13562         }
13563         else if ((0,grammar_utils/* isDataTypeRule */.UP)(rule)) {
13564             return DatatypeSymbol;
13565         }
13566         else {
13567             const explicit = (0,grammar_utils/* getExplicitRuleType */.$G)(rule);
13568             return explicit !== null && explicit !== void 0 ? explicit : rule.name;
13569         }
13570     }
13571     parse(input, options = {}) {
13572         this.nodeBuilder.buildRootNode(input);
13573         const lexerResult = this.lexerResult = this.lexer.tokenize(input);
13574         this.wrapper.input = lexerResult.tokens;
13575         const ruleMethod = options.rule ? this.allRules.get(options.rule) : this.mainRule;
13576         if (!ruleMethod) {
13577             throw new Error(options.rule ? `No rule found with name '${options.rule}'` : 'No main rule available.');
13578         }
13579         const result = ruleMethod.call(this.wrapper, {});
13580         this.nodeBuilder.addHiddenNodes(lexerResult.hidden);
13581         this.unorderedGroups.clear();
13582         this.lexerResult = undefined;
13583         return {
13584             value: result,
13585             lexerErrors: lexerResult.errors,
13586             lexerReport: lexerResult.report,
13587             parserErrors: this.wrapper.errors
13588         };
13589     }
13590     startImplementation($type, implementation) {
13591         return (args) => {
13592             // Only create a new AST node in case the calling rule is not a fragment rule
13593             const createNode = !this.isRecording() && $type !== undefined;
13594             if (createNode) {
13595                 const node = { $type };
13596                 this.stack.push(node);
13597                 if ($type === DatatypeSymbol) {
13598                     node.value = '';
13599                 }
13600             }
13601             let result;
13602             try {
13603                 result = implementation(args);
13604             }
13605             catch (err) {
13606                 result = undefined;
13607             }
13608             if (result === undefined && createNode) {
13609                 result = this.construct();
13610             }
13611             return result;
13612         };
13613     }
13614     extractHiddenTokens(token) {
13615         const hiddenTokens = this.lexerResult.hidden;
13616         if (!hiddenTokens.length) {
13617             return [];
13618         }
13619         const offset = token.startOffset;
13620         for (let i = 0; i < hiddenTokens.length; i++) {
13621             const token = hiddenTokens[i];
13622             if (token.startOffset > offset) {
13623                 return hiddenTokens.splice(0, i);
13624             }
13625         }
13626         return hiddenTokens.splice(0, hiddenTokens.length);
13627     }
13628     consume(idx, tokenType, feature) {
13629         const token = this.wrapper.wrapConsume(idx, tokenType);
13630         if (!this.isRecording() && this.isValidToken(token)) {
13631             const hiddenTokens = this.extractHiddenTokens(token);
13632             this.nodeBuilder.addHiddenNodes(hiddenTokens);
13633             const leafNode = this.nodeBuilder.buildLeafNode(token, feature);
13634             const { assignment, isCrossRef } = this.getAssignment(feature);
13635             const current = this.current;
13636             if (assignment) {
13637                 const convertedValue = (0,ast/* isKeyword */.p1)(feature) ? token.image : this.converter.convert(token.image, leafNode);
13638                 this.assign(assignment.operator, assignment.feature, convertedValue, leafNode, isCrossRef);
13639             }
13640             else if (isDataTypeNode(current)) {
13641                 let text = token.image;
13642                 if (!(0,ast/* isKeyword */.p1)(feature)) {
13643                     text = this.converter.convert(text, leafNode).toString();
13644                 }
13645                 current.value += text;
13646             }
13647         }
13648     }
13649     /**
13650      * Most consumed parser tokens are valid. However there are two cases in which they are not valid:
13651      *
13652      * 1. They were inserted during error recovery by the parser. These tokens don't really exist and should not be further processed
13653      * 2. They contain invalid token ranges. This might include the special EOF token, or other tokens produced by invalid token builders.
13654      */
13655     isValidToken(token) {
13656         return !token.isInsertedInRecovery && !isNaN(token.startOffset) && typeof token.endOffset === 'number' && !isNaN(token.endOffset);
13657     }
13658     subrule(idx, rule, fragment, feature, args) {
13659         let cstNode;
13660         if (!this.isRecording() && !fragment) {
13661             // We only want to create a new CST node if the subrule actually creates a new AST node.
13662             // In other cases like calls of fragment rules the current CST/AST is populated further.
13663             // Note that skipping this initialization and leaving cstNode unassigned also skips the subrule assignment later on.
13664             // This is intended, as fragment rules only enrich the current AST node
13665             cstNode = this.nodeBuilder.buildCompositeNode(feature);
13666         }
13667         const subruleResult = this.wrapper.wrapSubrule(idx, rule, args);
13668         if (!this.isRecording() && cstNode && cstNode.length > 0) {
13669             this.performSubruleAssignment(subruleResult, feature, cstNode);
13670         }
13671     }
13672     performSubruleAssignment(result, feature, cstNode) {
13673         const { assignment, isCrossRef } = this.getAssignment(feature);
13674         if (assignment) {
13675             this.assign(assignment.operator, assignment.feature, result, cstNode, isCrossRef);
13676         }
13677         else if (!assignment) {
13678             // If we call a subrule without an assignment we either:
13679             // 1. append the result of the subrule (data type rule)
13680             // 2. override the current object with the newly parsed object
13681             // If the current element is an AST node and the result of the subrule
13682             // is a data type rule, we can safely discard the results.
13683             const current = this.current;
13684             if (isDataTypeNode(current)) {
13685                 current.value += result.toString();
13686             }
13687             else if (typeof result === 'object' && result) {
13688                 const object = this.assignWithoutOverride(result, current);
13689                 const newItem = object;
13690                 this.stack.pop();
13691                 this.stack.push(newItem);
13692             }
13693         }
13694     }
13695     action($type, action) {
13696         if (!this.isRecording()) {
13697             let last = this.current;
13698             if (action.feature && action.operator) {
13699                 last = this.construct();
13700                 this.nodeBuilder.removeNode(last.$cstNode);
13701                 const node = this.nodeBuilder.buildCompositeNode(action);
13702                 node.content.push(last.$cstNode);
13703                 const newItem = { $type };
13704                 this.stack.push(newItem);
13705                 this.assign(action.operator, action.feature, last, last.$cstNode, false);
13706             }
13707             else {
13708                 last.$type = $type;
13709             }
13710         }
13711     }
13712     construct() {
13713         if (this.isRecording()) {
13714             return undefined;
13715         }
13716         const obj = this.current;
13717         (0,ast_utils/* linkContentToContainer */.b2)(obj);
13718         this.nodeBuilder.construct(obj);
13719         this.stack.pop();
13720         if (isDataTypeNode(obj)) {
13721             return this.converter.convert(obj.value, obj.$cstNode);
13722         }
13723         else {
13724             (0,ast_utils/* assignMandatoryProperties */.a1)(this.astReflection, obj);
13725         }
13726         return obj;
13727     }
13728     getAssignment(feature) {
13729         if (!this.assignmentMap.has(feature)) {
13730             const assignment = (0,ast_utils/* getContainerOfType */.V_)(feature, ast/* isAssignment */.B7);
13731             this.assignmentMap.set(feature, {
13732                 assignment: assignment,
13733                 isCrossRef: assignment ? (0,ast/* isCrossReference */.Ki)(assignment.terminal) : false
13734             });
13735         }
13736         return this.assignmentMap.get(feature);
13737     }
13738     assign(operator, feature, value, cstNode, isCrossRef) {
13739         const obj = this.current;
13740         let item;
13741         if (isCrossRef && typeof value === 'string') {
13742             item = this.linker.buildReference(obj, feature, cstNode, value);
13743         }
13744         else {
13745             item = value;
13746         }
13747         switch (operator) {
13748             case '=': {
13749                 obj[feature] = item;
13750                 break;
13751             }
13752             case '?=': {
13753                 obj[feature] = true;
13754                 break;
13755             }
13756             case '+=': {
13757                 if (!Array.isArray(obj[feature])) {
13758                     obj[feature] = [];
13759                 }
13760                 obj[feature].push(item);
13761             }
13762         }
13763     }
13764     assignWithoutOverride(target, source) {
13765         for (const [name, existingValue] of Object.entries(source)) {
13766             const newValue = target[name];
13767             if (newValue === undefined) {
13768                 target[name] = existingValue;
13769             }
13770             else if (Array.isArray(newValue) && Array.isArray(existingValue)) {
13771                 existingValue.push(...newValue);
13772                 target[name] = existingValue;
13773             }
13774         }
13775         // The target was parsed from a unassigned subrule
13776         // After the subrule construction, it received a cst node
13777         // This CST node will later be overriden by the cst node builder
13778         // To prevent references to stale AST nodes in the CST,
13779         // we need to remove the reference here
13780         const targetCstNode = target.$cstNode;
13781         if (targetCstNode) {
13782             targetCstNode.astNode = undefined;
13783             target.$cstNode = undefined;
13784         }
13785         return target;
13786     }
13787     get definitionErrors() {
13788         return this.wrapper.definitionErrors;
13789     }
13790 }
13791 class AbstractParserErrorMessageProvider {
13792     buildMismatchTokenMessage(options) {
13793         return api/* defaultParserErrorProvider */.Hs.buildMismatchTokenMessage(options);
13794     }
13795     buildNotAllInputParsedMessage(options) {
13796         return api/* defaultParserErrorProvider */.Hs.buildNotAllInputParsedMessage(options);
13797     }
13798     buildNoViableAltMessage(options) {
13799         return api/* defaultParserErrorProvider */.Hs.buildNoViableAltMessage(options);
13800     }
13801     buildEarlyExitMessage(options) {
13802         return api/* defaultParserErrorProvider */.Hs.buildEarlyExitMessage(options);
13803     }
13804 }
13805 class LangiumParserErrorMessageProvider extends AbstractParserErrorMessageProvider {
13806     buildMismatchTokenMessage({ expected, actual }) {
13807         const expectedMsg = expected.LABEL
13808             ? '`' + expected.LABEL + '`'
13809             : expected.name.endsWith(':KW')
13810                 ? `keyword '${expected.name.substring(0, expected.name.length - 3)}'`
13811                 : `token of type '${expected.name}'`;
13812         return `Expecting ${expectedMsg} but found \`${actual.image}\`.`;
13813     }
13814     buildNotAllInputParsedMessage({ firstRedundant }) {
13815         return `Expecting end of file but found \`${firstRedundant.image}\`.`;
13816     }
13817 }
13818 class LangiumCompletionParser extends AbstractLangiumParser {
13819     constructor() {
13820         super(...arguments);
13821         this.tokens = [];
13822         this.elementStack = [];
13823         this.lastElementStack = [];
13824         this.nextTokenIndex = 0;
13825         this.stackSize = 0;
13826     }
13827     action() {
13828         // NOOP
13829     }
13830     construct() {
13831         // NOOP
13832         return undefined;
13833     }
13834     parse(input) {
13835         this.resetState();
13836         const tokens = this.lexer.tokenize(input, { mode: 'partial' });
13837         this.tokens = tokens.tokens;
13838         this.wrapper.input = [...this.tokens];
13839         this.mainRule.call(this.wrapper, {});
13840         this.unorderedGroups.clear();
13841         return {
13842             tokens: this.tokens,
13843             elementStack: [...this.lastElementStack],
13844             tokenIndex: this.nextTokenIndex
13845         };
13846     }
13847     rule(rule, impl) {
13848         const ruleMethod = this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name), this.startImplementation(impl).bind(this));
13849         this.allRules.set(rule.name, ruleMethod);
13850         if (rule.entry) {
13851             this.mainRule = ruleMethod;
13852         }
13853         return ruleMethod;
13854     }
13855     resetState() {
13856         this.elementStack = [];
13857         this.lastElementStack = [];
13858         this.nextTokenIndex = 0;
13859         this.stackSize = 0;
13860     }
13861     startImplementation(implementation) {
13862         return (args) => {
13863             const size = this.keepStackSize();
13864             try {
13865                 implementation(args);
13866             }
13867             finally {
13868                 this.resetStackSize(size);
13869             }
13870         };
13871     }
13872     removeUnexpectedElements() {
13873         this.elementStack.splice(this.stackSize);
13874     }
13875     keepStackSize() {
13876         const size = this.elementStack.length;
13877         this.stackSize = size;
13878         return size;
13879     }
13880     resetStackSize(size) {
13881         this.removeUnexpectedElements();
13882         this.stackSize = size;
13883     }
13884     consume(idx, tokenType, feature) {
13885         this.wrapper.wrapConsume(idx, tokenType);
13886         if (!this.isRecording()) {
13887             this.lastElementStack = [...this.elementStack, feature];
13888             this.nextTokenIndex = this.currIdx + 1;
13889         }
13890     }
13891     subrule(idx, rule, fragment, feature, args) {
13892         this.before(feature);
13893         this.wrapper.wrapSubrule(idx, rule, args);
13894         this.after(feature);
13895     }
13896     before(element) {
13897         if (!this.isRecording()) {
13898             this.elementStack.push(element);
13899         }
13900     }
13901     after(element) {
13902         if (!this.isRecording()) {
13903             const index = this.elementStack.lastIndexOf(element);
13904             if (index >= 0) {
13905                 this.elementStack.splice(index);
13906             }
13907         }
13908     }
13909     get currIdx() {
13910         return this.wrapper.currIdx;
13911     }
13912 }
13913 const defaultConfig = {
13914     recoveryEnabled: true,
13915     nodeLocationTracking: 'full',
13916     skipValidations: true,
13917     errorMessageProvider: new LangiumParserErrorMessageProvider()
13918 };
13919 /**
13920  * This class wraps the embedded actions parser of chevrotain and exposes protected methods.
13921  * This way, we can build the `LangiumParser` as a composition.
13922  */
13923 class ChevrotainWrapper extends api/* EmbeddedActionsParser */.nu {
13924     constructor(tokens, config) {
13925         const useDefaultLookahead = config && 'maxLookahead' in config;
13926         super(tokens, Object.assign(Object.assign(Object.assign({}, defaultConfig), { lookaheadStrategy: useDefaultLookahead
13927                 ? new api/* LLkLookaheadStrategy */.dV({ maxLookahead: config.maxLookahead })
13928                 : new LLStarLookaheadStrategy({
13929                     // If validations are skipped, don't log the lookahead warnings
13930                     logging: config.skipValidations ? () => { } : undefined
13931                 }) }), config));
13932     }
13933     get IS_RECORDING() {
13934         return this.RECORDING_PHASE;
13935     }
13936     DEFINE_RULE(name, impl) {
13937         return this.RULE(name, impl);
13938     }
13939     wrapSelfAnalysis() {
13940         this.performSelfAnalysis();
13941     }
13942     wrapConsume(idx, tokenType) {
13943         return this.consume(idx, tokenType);
13944     }
13945     wrapSubrule(idx, rule, args) {
13946         return this.subrule(idx, rule, {
13947             ARGS: [args]
13948         });
13949     }
13950     wrapOr(idx, choices) {
13951         this.or(idx, choices);
13952     }
13953     wrapOption(idx, callback) {
13954         this.option(idx, callback);
13955     }
13956     wrapMany(idx, callback) {
13957         this.many(idx, callback);
13958     }
13959     wrapAtLeastOne(idx, callback) {
13960         this.atLeastOne(idx, callback);
13961     }
13962 }
13963 //# sourceMappingURL=langium-parser.js.map
13964 // EXTERNAL MODULE: ../node_modules/langium/lib/utils/errors.js
13965 var errors = __webpack_require__(45209);
13966 // EXTERNAL MODULE: ../node_modules/langium/lib/utils/stream.js
13967 var stream = __webpack_require__(99293);
13968 ;// CONCATENATED MODULE: ../node_modules/langium/lib/parser/parser-builder-base.js
13969 /******************************************************************************
13970  * Copyright 2022 TypeFox GmbH
13971  * This program and the accompanying materials are made available under the
13972  * terms of the MIT License, which is available in the project root.
13973  ******************************************************************************/
13974 
13975 
13976 
13977 
13978 
13979 function createParser(grammar, parser, tokens) {
13980     const parserContext = {
13981         parser,
13982         tokens,
13983         ruleNames: new Map()
13984     };
13985     buildRules(parserContext, grammar);
13986     return parser;
13987 }
13988 function buildRules(parserContext, grammar) {
13989     const reachable = (0,grammar_utils/* getAllReachableRules */.VD)(grammar, false);
13990     const parserRules = (0,stream/* stream */.Vw)(grammar.rules).filter(ast/* isParserRule */.F9).filter(rule => reachable.has(rule));
13991     for (const rule of parserRules) {
13992         const ctx = Object.assign(Object.assign({}, parserContext), { consume: 1, optional: 1, subrule: 1, many: 1, or: 1 });
13993         parserContext.parser.rule(rule, buildElement(ctx, rule.definition));
13994     }
13995 }
13996 function buildElement(ctx, element, ignoreGuard = false) {
13997     let method;
13998     if ((0,ast/* isKeyword */.p1)(element)) {
13999         method = buildKeyword(ctx, element);
14000     }
14001     else if ((0,ast/* isAction */.LG)(element)) {
14002         method = buildAction(ctx, element);
14003     }
14004     else if ((0,ast/* isAssignment */.B7)(element)) {
14005         method = buildElement(ctx, element.terminal);
14006     }
14007     else if ((0,ast/* isCrossReference */.Ki)(element)) {
14008         method = buildCrossReference(ctx, element);
14009     }
14010     else if ((0,ast/* isRuleCall */.t3)(element)) {
14011         method = buildRuleCall(ctx, element);
14012     }
14013     else if ((0,ast/* isAlternatives */.MZ)(element)) {
14014         method = buildAlternatives(ctx, element);
14015     }
14016     else if ((0,ast/* isUnorderedGroup */.W1)(element)) {
14017         method = buildUnorderedGroup(ctx, element);
14018     }
14019     else if ((0,ast/* isGroup */.ty)(element)) {
14020         method = buildGroup(ctx, element);
14021     }
14022     else if ((0,ast/* isEndOfFile */.rT)(element)) {
14023         const idx = ctx.consume++;
14024         method = () => ctx.parser.consume(idx, api/* EOF */.sd, element);
14025     }
14026     else {
14027         throw new errors/* ErrorWithLocation */.h(element.$cstNode, `Unexpected element type: ${element.$type}`);
14028     }
14029     return wrap(ctx, ignoreGuard ? undefined : getGuardCondition(element), method, element.cardinality);
14030 }
14031 function buildAction(ctx, action) {
14032     const actionType = (0,grammar_utils/* getTypeName */.z$)(action);
14033     return () => ctx.parser.action(actionType, action);
14034 }
14035 function buildRuleCall(ctx, ruleCall) {
14036     const rule = ruleCall.rule.ref;
14037     if ((0,ast/* isParserRule */.F9)(rule)) {
14038         const idx = ctx.subrule++;
14039         const fragment = rule.fragment;
14040         const predicate = ruleCall.arguments.length > 0 ? buildRuleCallPredicate(rule, ruleCall.arguments) : () => ({});
14041         return (args) => ctx.parser.subrule(idx, getRule(ctx, rule), fragment, ruleCall, predicate(args));
14042     }
14043     else if ((0,ast/* isTerminalRule */.MS)(rule)) {
14044         const idx = ctx.consume++;
14045         const method = getToken(ctx, rule.name);
14046         return () => ctx.parser.consume(idx, method, ruleCall);
14047     }
14048     else if (!rule) {
14049         throw new errors/* ErrorWithLocation */.h(ruleCall.$cstNode, `Undefined rule: ${ruleCall.rule.$refText}`);
14050     }
14051     else {
14052         (0,errors/* assertUnreachable */.U)(rule);
14053     }
14054 }
14055 function buildRuleCallPredicate(rule, namedArgs) {
14056     const predicates = namedArgs.map(e => buildPredicate(e.value));
14057     return (args) => {
14058         const ruleArgs = {};
14059         for (let i = 0; i < predicates.length; i++) {
14060             const ruleTarget = rule.parameters[i];
14061             const predicate = predicates[i];
14062             ruleArgs[ruleTarget.name] = predicate(args);
14063         }
14064         return ruleArgs;
14065     };
14066 }
14067 function buildPredicate(condition) {
14068     if ((0,ast/* isDisjunction */.F8)(condition)) {
14069         const left = buildPredicate(condition.left);
14070         const right = buildPredicate(condition.right);
14071         return (args) => (left(args) || right(args));
14072     }
14073     else if ((0,ast/* isConjunction */.TB)(condition)) {
14074         const left = buildPredicate(condition.left);
14075         const right = buildPredicate(condition.right);
14076         return (args) => (left(args) && right(args));
14077     }
14078     else if ((0,ast/* isNegation */.Ii)(condition)) {
14079         const value = buildPredicate(condition.value);
14080         return (args) => !value(args);
14081     }
14082     else if ((0,ast/* isParameterReference */.yW)(condition)) {
14083         const name = condition.parameter.ref.name;
14084         return (args) => args !== undefined && args[name] === true;
14085     }
14086     else if ((0,ast/* isBooleanLiteral */.L)(condition)) {
14087         const value = Boolean(condition.true);
14088         return () => value;
14089     }
14090     (0,errors/* assertUnreachable */.U)(condition);
14091 }
14092 function buildAlternatives(ctx, alternatives) {
14093     if (alternatives.elements.length === 1) {
14094         return buildElement(ctx, alternatives.elements[0]);
14095     }
14096     else {
14097         const methods = [];
14098         for (const element of alternatives.elements) {
14099             const predicatedMethod = {
14100                 // Since we handle the guard condition in the alternative already
14101                 // We can ignore the group guard condition inside
14102                 ALT: buildElement(ctx, element, true)
14103             };
14104             const guard = getGuardCondition(element);
14105             if (guard) {
14106                 predicatedMethod.GATE = buildPredicate(guard);
14107             }
14108             methods.push(predicatedMethod);
14109         }
14110         const idx = ctx.or++;
14111         return (args) => ctx.parser.alternatives(idx, methods.map(method => {
14112             const alt = {
14113                 ALT: () => method.ALT(args)
14114             };
14115             const gate = method.GATE;
14116             if (gate) {
14117                 alt.GATE = () => gate(args);
14118             }
14119             return alt;
14120         }));
14121     }
14122 }
14123 function buildUnorderedGroup(ctx, group) {
14124     if (group.elements.length === 1) {
14125         return buildElement(ctx, group.elements[0]);
14126     }
14127     const methods = [];
14128     for (const element of group.elements) {
14129         const predicatedMethod = {
14130             // Since we handle the guard condition in the alternative already
14131             // We can ignore the group guard condition inside
14132             ALT: buildElement(ctx, element, true)
14133         };
14134         const guard = getGuardCondition(element);
14135         if (guard) {
14136             predicatedMethod.GATE = buildPredicate(guard);
14137         }
14138         methods.push(predicatedMethod);
14139     }
14140     const orIdx = ctx.or++;
14141     const idFunc = (groupIdx, lParser) => {
14142         const stackId = lParser.getRuleStack().join('-');
14143         return `uGroup_${groupIdx}_${stackId}`;
14144     };
14145     const alternatives = (args) => ctx.parser.alternatives(orIdx, methods.map((method, idx) => {
14146         const alt = { ALT: () => true };
14147         const parser = ctx.parser;
14148         alt.ALT = () => {
14149             method.ALT(args);
14150             if (!parser.isRecording()) {
14151                 const key = idFunc(orIdx, parser);
14152                 if (!parser.unorderedGroups.get(key)) {
14153                     // init after clear state
14154                     parser.unorderedGroups.set(key, []);
14155                 }
14156                 const groupState = parser.unorderedGroups.get(key);
14157                 if (typeof (groupState === null || groupState === void 0 ? void 0 : groupState[idx]) === 'undefined') {
14158                     // Not accessed yet
14159                     groupState[idx] = true;
14160                 }
14161             }
14162         };
14163         const gate = method.GATE;
14164         if (gate) {
14165             alt.GATE = () => gate(args);
14166         }
14167         else {
14168             alt.GATE = () => {
14169                 const trackedAlternatives = parser.unorderedGroups.get(idFunc(orIdx, parser));
14170                 const allow = !(trackedAlternatives === null || trackedAlternatives === void 0 ? void 0 : trackedAlternatives[idx]);
14171                 return allow;
14172             };
14173         }
14174         return alt;
14175     }));
14176     const wrapped = wrap(ctx, getGuardCondition(group), alternatives, '*');
14177     return (args) => {
14178         wrapped(args);
14179         if (!ctx.parser.isRecording()) {
14180             ctx.parser.unorderedGroups.delete(idFunc(orIdx, ctx.parser));
14181         }
14182     };
14183 }
14184 function buildGroup(ctx, group) {
14185     const methods = group.elements.map(e => buildElement(ctx, e));
14186     return (args) => methods.forEach(method => method(args));
14187 }
14188 function getGuardCondition(element) {
14189     if ((0,ast/* isGroup */.ty)(element)) {
14190         return element.guardCondition;
14191     }
14192     return undefined;
14193 }
14194 function buildCrossReference(ctx, crossRef, terminal = crossRef.terminal) {
14195     if (!terminal) {
14196         if (!crossRef.type.ref) {
14197             throw new Error('Could not resolve reference to type: ' + crossRef.type.$refText);
14198         }
14199         const assignment = (0,grammar_utils/* findNameAssignment */.ib)(crossRef.type.ref);
14200         const assignTerminal = assignment === null || assignment === void 0 ? void 0 : assignment.terminal;
14201         if (!assignTerminal) {
14202             throw new Error('Could not find name assignment for type: ' + (0,grammar_utils/* getTypeName */.z$)(crossRef.type.ref));
14203         }
14204         return buildCrossReference(ctx, crossRef, assignTerminal);
14205     }
14206     else if ((0,ast/* isRuleCall */.t3)(terminal) && (0,ast/* isParserRule */.F9)(terminal.rule.ref)) {
14207         // The terminal is a data type rule here. Everything else will result in a validation error.
14208         const rule = terminal.rule.ref;
14209         const idx = ctx.subrule++;
14210         return (args) => ctx.parser.subrule(idx, getRule(ctx, rule), false, crossRef, args);
14211     }
14212     else if ((0,ast/* isRuleCall */.t3)(terminal) && (0,ast/* isTerminalRule */.MS)(terminal.rule.ref)) {
14213         const idx = ctx.consume++;
14214         const terminalRule = getToken(ctx, terminal.rule.ref.name);
14215         return () => ctx.parser.consume(idx, terminalRule, crossRef);
14216     }
14217     else if ((0,ast/* isKeyword */.p1)(terminal)) {
14218         const idx = ctx.consume++;
14219         const keyword = getToken(ctx, terminal.value);
14220         return () => ctx.parser.consume(idx, keyword, crossRef);
14221     }
14222     else {
14223         throw new Error('Could not build cross reference parser');
14224     }
14225 }
14226 function buildKeyword(ctx, keyword) {
14227     const idx = ctx.consume++;
14228     const token = ctx.tokens[keyword.value];
14229     if (!token) {
14230         throw new Error('Could not find token for keyword: ' + keyword.value);
14231     }
14232     return () => ctx.parser.consume(idx, token, keyword);
14233 }
14234 function wrap(ctx, guard, method, cardinality) {
14235     const gate = guard && buildPredicate(guard);
14236     if (!cardinality) {
14237         if (gate) {
14238             const idx = ctx.or++;
14239             return (args) => ctx.parser.alternatives(idx, [
14240                 {
14241                     ALT: () => method(args),
14242                     GATE: () => gate(args)
14243                 },
14244                 {
14245                     ALT: (0,api/* EMPTY_ALT */._o)(),
14246                     GATE: () => !gate(args)
14247                 }
14248             ]);
14249         }
14250         else {
14251             return method;
14252         }
14253     }
14254     if (cardinality === '*') {
14255         const idx = ctx.many++;
14256         return (args) => ctx.parser.many(idx, {
14257             DEF: () => method(args),
14258             GATE: gate ? () => gate(args) : undefined
14259         });
14260     }
14261     else if (cardinality === '+') {
14262         const idx = ctx.many++;
14263         if (gate) {
14264             const orIdx = ctx.or++;
14265             // In the case of a guard condition for the `+` group
14266             // We combine it with an empty alternative
14267             // If the condition returns true, it needs to parse at least a single iteration
14268             // If its false, it is not allowed to parse anything
14269             return (args) => ctx.parser.alternatives(orIdx, [
14270                 {
14271                     ALT: () => ctx.parser.atLeastOne(idx, {
14272                         DEF: () => method(args)
14273                     }),
14274                     GATE: () => gate(args)
14275                 },
14276                 {
14277                     ALT: (0,api/* EMPTY_ALT */._o)(),
14278                     GATE: () => !gate(args)
14279                 }
14280             ]);
14281         }
14282         else {
14283             return (args) => ctx.parser.atLeastOne(idx, {
14284                 DEF: () => method(args),
14285             });
14286         }
14287     }
14288     else if (cardinality === '?') {
14289         const idx = ctx.optional++;
14290         return (args) => ctx.parser.optional(idx, {
14291             DEF: () => method(args),
14292             GATE: gate ? () => gate(args) : undefined
14293         });
14294     }
14295     else {
14296         (0,errors/* assertUnreachable */.U)(cardinality);
14297     }
14298 }
14299 function getRule(ctx, element) {
14300     const name = getRuleName(ctx, element);
14301     const rule = ctx.parser.getRule(name);
14302     if (!rule)
14303         throw new Error(`Rule "${name}" not found."`);
14304     return rule;
14305 }
14306 function getRuleName(ctx, element) {
14307     if ((0,ast/* isParserRule */.F9)(element)) {
14308         return element.name;
14309     }
14310     else if (ctx.ruleNames.has(element)) {
14311         return ctx.ruleNames.get(element);
14312     }
14313     else {
14314         let item = element;
14315         let parent = item.$container;
14316         let ruleName = element.$type;
14317         while (!(0,ast/* isParserRule */.F9)(parent)) {
14318             if ((0,ast/* isGroup */.ty)(parent) || (0,ast/* isAlternatives */.MZ)(parent) || (0,ast/* isUnorderedGroup */.W1)(parent)) {
14319                 const index = parent.elements.indexOf(item);
14320                 ruleName = index.toString() + ':' + ruleName;
14321             }
14322             item = parent;
14323             parent = parent.$container;
14324         }
14325         const rule = parent;
14326         ruleName = rule.name + ':' + ruleName;
14327         ctx.ruleNames.set(element, ruleName);
14328         return ruleName;
14329     }
14330 }
14331 function getToken(ctx, name) {
14332     const token = ctx.tokens[name];
14333     if (!token)
14334         throw new Error(`Token "${name}" not found."`);
14335     return token;
14336 }
14337 //# sourceMappingURL=parser-builder-base.js.map
14338 ;// CONCATENATED MODULE: ../node_modules/langium/lib/parser/completion-parser-builder.js
14339 /******************************************************************************
14340  * Copyright 2022 TypeFox GmbH
14341  * This program and the accompanying materials are made available under the
14342  * terms of the MIT License, which is available in the project root.
14343  ******************************************************************************/
14344 
14345 
14346 function createCompletionParser(services) {
14347     const grammar = services.Grammar;
14348     const lexer = services.parser.Lexer;
14349     const parser = new LangiumCompletionParser(services);
14350     createParser(grammar, parser, lexer.definition);
14351     parser.finalize();
14352     return parser;
14353 }
14354 //# sourceMappingURL=completion-parser-builder.js.map
14355 ;// CONCATENATED MODULE: ../node_modules/langium/lib/parser/langium-parser-builder.js
14356 /******************************************************************************
14357  * Copyright 2021 TypeFox GmbH
14358  * This program and the accompanying materials are made available under the
14359  * terms of the MIT License, which is available in the project root.
14360  ******************************************************************************/
14361 
14362 
14363 /**
14364  * Create and finalize a Langium parser. The parser rules are derived from the grammar, which is
14365  * available at `services.Grammar`.
14366  */
14367 function createLangiumParser(services) {
14368     const parser = prepareLangiumParser(services);
14369     parser.finalize();
14370     return parser;
14371 }
14372 /**
14373  * Create a Langium parser without finalizing it. This is used to extract more detailed error
14374  * information when the parser is initially validated.
14375  */
14376 function prepareLangiumParser(services) {
14377     const grammar = services.Grammar;
14378     const lexer = services.parser.Lexer;
14379     const parser = new LangiumParser(services);
14380     return createParser(grammar, parser, lexer.definition);
14381 }
14382 //# sourceMappingURL=langium-parser-builder.js.map
14383 // EXTERNAL MODULE: ../node_modules/langium/lib/parser/token-builder.js
14384 var token_builder = __webpack_require__(35481);
14385 // EXTERNAL MODULE: ../node_modules/langium/lib/parser/value-converter.js
14386 var value_converter = __webpack_require__(46174);
14387 // EXTERNAL MODULE: ../node_modules/vscode-jsonrpc/lib/common/cancellation.js
14388 var cancellation = __webpack_require__(97770);
14389 // EXTERNAL MODULE: ../node_modules/langium/lib/syntax-tree.js
14390 var syntax_tree = __webpack_require__(91303);
14391 ;// CONCATENATED MODULE: ../node_modules/langium/lib/utils/promise-utils.js
14392 /******************************************************************************
14393  * Copyright 2021 TypeFox GmbH
14394  * This program and the accompanying materials are made available under the
14395  * terms of the MIT License, which is available in the project root.
14396  ******************************************************************************/
14397 
14398 /**
14399  * Delays the execution of the current code to the next tick of the event loop.
14400  * Don't call this method directly in a tight loop to prevent too many promises from being created.
14401  */
14402 function delayNextTick() {
14403     return new Promise(resolve => {
14404         // In case we are running in a non-node environment, `setImmediate` isn't available.
14405         // Using `setTimeout` of the browser API accomplishes the same result.
14406         if (typeof setImmediate === 'undefined') {
14407             setTimeout(resolve, 0);
14408         }
14409         else {
14410             setImmediate(resolve);
14411         }
14412     });
14413 }
14414 let lastTick = 0;
14415 let globalInterruptionPeriod = 10;
14416 /**
14417  * Reset the global interruption period and create a cancellation token source.
14418  */
14419 function startCancelableOperation() {
14420     lastTick = performance.now();
14421     return new cancellation.CancellationTokenSource();
14422 }
14423 /**
14424  * Change the period duration for `interruptAndCheck` to the given number of milliseconds.
14425  * The default value is 10ms.
14426  */
14427 function setInterruptionPeriod(period) {
14428     globalInterruptionPeriod = period;
14429 }
14430 /**
14431  * This symbol may be thrown in an asynchronous context by any Langium service that receives
14432  * a `CancellationToken`. This means that the promise returned by such a service is rejected with
14433  * this symbol as rejection reason.
14434  */
14435 const promise_utils_OperationCancelled = Symbol('OperationCancelled');
14436 /**
14437  * Use this in a `catch` block to check whether the thrown object indicates that the operation
14438  * has been cancelled.
14439  */
14440 function isOperationCancelled(err) {
14441     return err === promise_utils_OperationCancelled;
14442 }
14443 /**
14444  * This function does two things:
14445  *  1. Check the elapsed time since the last call to this function or to `startCancelableOperation`. If the predefined
14446  *     period (configured with `setInterruptionPeriod`) is exceeded, execution is delayed with `delayNextTick`.
14447  *  2. If the predefined period is not met yet or execution is resumed after an interruption, the given cancellation
14448  *     token is checked, and if cancellation is requested, `OperationCanceled` is thrown.
14449  *
14450  * All services in Langium that receive a `CancellationToken` may potentially call this function, so the
14451  * `CancellationToken` must be caught (with an `async` try-catch block or a `catch` callback attached to
14452  * the promise) to avoid that event being exposed as an error.
14453  */
14454 async function interruptAndCheck(token) {
14455     if (token === cancellation.CancellationToken.None) {
14456         // Early exit in case cancellation was disabled by the caller
14457         return;
14458     }
14459     const current = performance.now();
14460     if (current - lastTick >= globalInterruptionPeriod) {
14461         lastTick = current;
14462         await delayNextTick();
14463         // prevent calling delayNextTick every iteration of loop
14464         // where delayNextTick takes up the majority or all of the
14465         // globalInterruptionPeriod itself
14466         lastTick = performance.now();
14467     }
14468     if (token.isCancellationRequested) {
14469         throw promise_utils_OperationCancelled;
14470     }
14471 }
14472 /**
14473  * Simple implementation of the deferred pattern.
14474  * An object that exposes a promise and functions to resolve and reject it.
14475  */
14476 class promise_utils_Deferred {
14477     constructor() {
14478         this.promise = new Promise((resolve, reject) => {
14479             this.resolve = (arg) => {
14480                 resolve(arg);
14481                 return this;
14482             };
14483             this.reject = (err) => {
14484                 reject(err);
14485                 return this;
14486             };
14487         });
14488     }
14489 }
14490 //# sourceMappingURL=promise-utils.js.map
14491 ;// CONCATENATED MODULE: ../node_modules/vscode-languageserver-textdocument/lib/esm/main.js
14492 /* -------------------------------------------------------------------------------------------- 
14493  * Copyright (c) Microsoft Corporation. All rights reserved. 
14494  * Licensed under the MIT License. See License.txt in the project root for license information. 
14495  * ------------------------------------------------------------------------------------------ */
14496 
14497 class main_FullTextDocument {
14498     constructor(uri, languageId, version, content) {
14499         this._uri = uri;
14500         this._languageId = languageId;
14501         this._version = version;
14502         this._content = content;
14503         this._lineOffsets = undefined;
14504     }
14505     get uri() {
14506         return this._uri;
14507     }
14508     get languageId() {
14509         return this._languageId;
14510     }
14511     get version() {
14512         return this._version;
14513     }
14514     getText(range) {
14515         if (range) {
14516             const start = this.offsetAt(range.start);
14517             const end = this.offsetAt(range.end);
14518             return this._content.substring(start, end);
14519         }
14520         return this._content;
14521     }
14522     update(changes, version) {
14523         for (const change of changes) {
14524             if (main_FullTextDocument.isIncremental(change)) {
14525                 // makes sure start is before end
14526                 const range = getWellformedRange(change.range);
14527                 // update content
14528                 const startOffset = this.offsetAt(range.start);
14529                 const endOffset = this.offsetAt(range.end);
14530                 this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);
14531                 // update the offsets
14532                 const startLine = Math.max(range.start.line, 0);
14533                 const endLine = Math.max(range.end.line, 0);
14534                 let lineOffsets = this._lineOffsets;
14535                 const addedLineOffsets = computeLineOffsets(change.text, false, startOffset);
14536                 if (endLine - startLine === addedLineOffsets.length) {
14537                     for (let i = 0, len = addedLineOffsets.length; i < len; i++) {
14538                         lineOffsets[i + startLine + 1] = addedLineOffsets[i];
14539                     }
14540                 }
14541                 else {
14542                     if (addedLineOffsets.length < 10000) {
14543                         lineOffsets.splice(startLine + 1, endLine - startLine, ...addedLineOffsets);
14544                     }
14545                     else { // avoid too many arguments for splice
14546                         this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));
14547                     }
14548                 }
14549                 const diff = change.text.length - (endOffset - startOffset);
14550                 if (diff !== 0) {
14551                     for (let i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) {
14552                         lineOffsets[i] = lineOffsets[i] + diff;
14553                     }
14554                 }
14555             }
14556             else if (main_FullTextDocument.isFull(change)) {
14557                 this._content = change.text;
14558                 this._lineOffsets = undefined;
14559             }
14560             else {
14561                 throw new Error('Unknown change event received');
14562             }
14563         }
14564         this._version = version;
14565     }
14566     getLineOffsets() {
14567         if (this._lineOffsets === undefined) {
14568             this._lineOffsets = computeLineOffsets(this._content, true);
14569         }
14570         return this._lineOffsets;
14571     }
14572     positionAt(offset) {
14573         offset = Math.max(Math.min(offset, this._content.length), 0);
14574         const lineOffsets = this.getLineOffsets();
14575         let low = 0, high = lineOffsets.length;
14576         if (high === 0) {
14577             return { line: 0, character: offset };
14578         }
14579         while (low < high) {
14580             const mid = Math.floor((low + high) / 2);
14581             if (lineOffsets[mid] > offset) {
14582                 high = mid;
14583             }
14584             else {
14585                 low = mid + 1;
14586             }
14587         }
14588         // low is the least x for which the line offset is larger than the current offset
14589         // or array.length if no line offset is larger than the current offset
14590         const line = low - 1;
14591         offset = this.ensureBeforeEOL(offset, lineOffsets[line]);
14592         return { line, character: offset - lineOffsets[line] };
14593     }
14594     offsetAt(position) {
14595         const lineOffsets = this.getLineOffsets();
14596         if (position.line >= lineOffsets.length) {
14597             return this._content.length;
14598         }
14599         else if (position.line < 0) {
14600             return 0;
14601         }
14602         const lineOffset = lineOffsets[position.line];
14603         if (position.character <= 0) {
14604             return lineOffset;
14605         }
14606         const nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
14607         const offset = Math.min(lineOffset + position.character, nextLineOffset);
14608         return this.ensureBeforeEOL(offset, lineOffset);
14609     }
14610     ensureBeforeEOL(offset, lineOffset) {
14611         while (offset > lineOffset && isEOL(this._content.charCodeAt(offset - 1))) {
14612             offset--;
14613         }
14614         return offset;
14615     }
14616     get lineCount() {
14617         return this.getLineOffsets().length;
14618     }
14619     static isIncremental(event) {
14620         const candidate = event;
14621         return candidate !== undefined && candidate !== null &&
14622             typeof candidate.text === 'string' && candidate.range !== undefined &&
14623             (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');
14624     }
14625     static isFull(event) {
14626         const candidate = event;
14627         return candidate !== undefined && candidate !== null &&
14628             typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;
14629     }
14630 }
14631 var main_TextDocument;
14632 (function (TextDocument) {
14633     /**
14634      * Creates a new text document.
14635      *
14636      * @param uri The document's uri.
14637      * @param languageId  The document's language Id.
14638      * @param version The document's initial version number.
14639      * @param content The document's content.
14640      */
14641     function create(uri, languageId, version, content) {
14642         return new main_FullTextDocument(uri, languageId, version, content);
14643     }
14644     TextDocument.create = create;
14645     /**
14646      * Updates a TextDocument by modifying its content.
14647      *
14648      * @param document the document to update. Only documents created by TextDocument.create are valid inputs.
14649      * @param changes the changes to apply to the document.
14650      * @param version the changes version for the document.
14651      * @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.
14652      *
14653      */
14654     function update(document, changes, version) {
14655         if (document instanceof main_FullTextDocument) {
14656             document.update(changes, version);
14657             return document;
14658         }
14659         else {
14660             throw new Error('TextDocument.update: document must be created by TextDocument.create');
14661         }
14662     }
14663     TextDocument.update = update;
14664     function applyEdits(document, edits) {
14665         const text = document.getText();
14666         const sortedEdits = mergeSort(edits.map(getWellformedEdit), (a, b) => {
14667             const diff = a.range.start.line - b.range.start.line;
14668             if (diff === 0) {
14669                 return a.range.start.character - b.range.start.character;
14670             }
14671             return diff;
14672         });
14673         let lastModifiedOffset = 0;
14674         const spans = [];
14675         for (const e of sortedEdits) {
14676             const startOffset = document.offsetAt(e.range.start);
14677             if (startOffset < lastModifiedOffset) {
14678                 throw new Error('Overlapping edit');
14679             }
14680             else if (startOffset > lastModifiedOffset) {
14681                 spans.push(text.substring(lastModifiedOffset, startOffset));
14682             }
14683             if (e.newText.length) {
14684                 spans.push(e.newText);
14685             }
14686             lastModifiedOffset = document.offsetAt(e.range.end);
14687         }
14688         spans.push(text.substr(lastModifiedOffset));
14689         return spans.join('');
14690     }
14691     TextDocument.applyEdits = applyEdits;
14692 })(main_TextDocument || (main_TextDocument = {}));
14693 function mergeSort(data, compare) {
14694     if (data.length <= 1) {
14695         // sorted
14696         return data;
14697     }
14698     const p = (data.length / 2) | 0;
14699     const left = data.slice(0, p);
14700     const right = data.slice(p);
14701     mergeSort(left, compare);
14702     mergeSort(right, compare);
14703     let leftIdx = 0;
14704     let rightIdx = 0;
14705     let i = 0;
14706     while (leftIdx < left.length && rightIdx < right.length) {
14707         const ret = compare(left[leftIdx], right[rightIdx]);
14708         if (ret <= 0) {
14709             // smaller_equal -> take left to preserve order
14710             data[i++] = left[leftIdx++];
14711         }
14712         else {
14713             // greater -> take right
14714             data[i++] = right[rightIdx++];
14715         }
14716     }
14717     while (leftIdx < left.length) {
14718         data[i++] = left[leftIdx++];
14719     }
14720     while (rightIdx < right.length) {
14721         data[i++] = right[rightIdx++];
14722     }
14723     return data;
14724 }
14725 function computeLineOffsets(text, isAtLineStart, textOffset = 0) {
14726     const result = isAtLineStart ? [textOffset] : [];
14727     for (let i = 0; i < text.length; i++) {
14728         const ch = text.charCodeAt(i);
14729         if (isEOL(ch)) {
14730             if (ch === 13 /* CharCode.CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* CharCode.LineFeed */) {
14731                 i++;
14732             }
14733             result.push(textOffset + i + 1);
14734         }
14735     }
14736     return result;
14737 }
14738 function isEOL(char) {
14739     return char === 13 /* CharCode.CarriageReturn */ || char === 10 /* CharCode.LineFeed */;
14740 }
14741 function getWellformedRange(range) {
14742     const start = range.start;
14743     const end = range.end;
14744     if (start.line > end.line || (start.line === end.line && start.character > end.character)) {
14745         return { start: end, end: start };
14746     }
14747     return range;
14748 }
14749 function getWellformedEdit(textEdit) {
14750     const range = getWellformedRange(textEdit.range);
14751     if (range !== textEdit.range) {
14752         return { newText: textEdit.newText, range };
14753     }
14754     return textEdit;
14755 }
14756 
14757 // EXTERNAL MODULE: ../node_modules/vscode-uri/lib/esm/index.mjs
14758 var esm = __webpack_require__(37943);
14759 ;// CONCATENATED MODULE: ../node_modules/langium/lib/workspace/documents.js
14760 /******************************************************************************
14761  * Copyright 2021 TypeFox GmbH
14762  * This program and the accompanying materials are made available under the
14763  * terms of the MIT License, which is available in the project root.
14764  ******************************************************************************/
14765 /**
14766  * Re-export 'TextDocument' from 'vscode-languageserver-textdocument' for convenience,
14767  *  including both type _and_ symbol (namespace), as we here and there also refer to the symbol,
14768  *  the overhead is very small, just a few kilobytes.
14769  * Everything else of that package (at the time contributing) is also defined
14770  *  in 'vscode-languageserver-protocol' or 'vscode-languageserver-types'.
14771  */
14772 
14773 
14774 
14775 
14776 
14777 /**
14778  * A document is subject to several phases that are run in predefined order. Any state value implies that
14779  * smaller state values are finished as well.
14780  */
14781 var DocumentState;
14782 (function (DocumentState) {
14783     /**
14784      * The text content has changed and needs to be parsed again. The AST held by this outdated
14785      * document instance is no longer valid.
14786      */
14787     DocumentState[DocumentState["Changed"] = 0] = "Changed";
14788     /**
14789      * An AST has been created from the text content. The document structure can be traversed,
14790      * but cross-references cannot be resolved yet. If necessary, the structure can be manipulated
14791      * at this stage as a preprocessing step.
14792      */
14793     DocumentState[DocumentState["Parsed"] = 1] = "Parsed";
14794     /**
14795      * The `IndexManager` service has processed AST nodes of this document. This means the
14796      * exported symbols are available in the global scope and can be resolved from other documents.
14797      */
14798     DocumentState[DocumentState["IndexedContent"] = 2] = "IndexedContent";
14799     /**
14800      * The `ScopeComputation` service has processed this document. This means the local symbols
14801      * are stored in a MultiMap so they can be looked up by the `ScopeProvider` service.
14802      * Once a document has reached this state, you may follow every reference - it will lazily
14803      * resolve its `ref` property and yield either the target AST node or `undefined` in case
14804      * the target is not in scope.
14805      */
14806     DocumentState[DocumentState["ComputedScopes"] = 3] = "ComputedScopes";
14807     /**
14808      * The `Linker` service has processed this document. All outgoing references have been
14809      * resolved or marked as erroneous.
14810      */
14811     DocumentState[DocumentState["Linked"] = 4] = "Linked";
14812     /**
14813      * The `IndexManager` service has processed AST node references of this document. This is
14814      * necessary to determine which documents are affected by a change in one of the workspace
14815      * documents.
14816      */
14817     DocumentState[DocumentState["IndexedReferences"] = 5] = "IndexedReferences";
14818     /**
14819      * The `DocumentValidator` service has processed this document. The language server listens
14820      * to the results of this phase and sends diagnostics to the client.
14821      */
14822     DocumentState[DocumentState["Validated"] = 6] = "Validated";
14823 })(DocumentState || (DocumentState = {}));
14824 class DefaultLangiumDocumentFactory {
14825     constructor(services) {
14826         this.serviceRegistry = services.ServiceRegistry;
14827         this.textDocuments = services.workspace.TextDocuments;
14828         this.fileSystemProvider = services.workspace.FileSystemProvider;
14829     }
14830     async fromUri(uri, cancellationToken = cancellation.CancellationToken.None) {
14831         const content = await this.fileSystemProvider.readFile(uri);
14832         return this.createAsync(uri, content, cancellationToken);
14833     }
14834     fromTextDocument(textDocument, uri, token) {
14835         uri = uri !== null && uri !== void 0 ? uri : esm/* URI */.o.parse(textDocument.uri);
14836         if (cancellation.CancellationToken.is(token)) {
14837             return this.createAsync(uri, textDocument, token);
14838         }
14839         else {
14840             return this.create(uri, textDocument, token);
14841         }
14842     }
14843     fromString(text, uri, token) {
14844         if (cancellation.CancellationToken.is(token)) {
14845             return this.createAsync(uri, text, token);
14846         }
14847         else {
14848             return this.create(uri, text, token);
14849         }
14850     }
14851     fromModel(model, uri) {
14852         return this.create(uri, { $model: model });
14853     }
14854     create(uri, content, options) {
14855         if (typeof content === 'string') {
14856             const parseResult = this.parse(uri, content, options);
14857             return this.createLangiumDocument(parseResult, uri, undefined, content);
14858         }
14859         else if ('$model' in content) {
14860             const parseResult = { value: content.$model, parserErrors: [], lexerErrors: [] };
14861             return this.createLangiumDocument(parseResult, uri);
14862         }
14863         else {
14864             const parseResult = this.parse(uri, content.getText(), options);
14865             return this.createLangiumDocument(parseResult, uri, content);
14866         }
14867     }
14868     async createAsync(uri, content, cancelToken) {
14869         if (typeof content === 'string') {
14870             const parseResult = await this.parseAsync(uri, content, cancelToken);
14871             return this.createLangiumDocument(parseResult, uri, undefined, content);
14872         }
14873         else {
14874             const parseResult = await this.parseAsync(uri, content.getText(), cancelToken);
14875             return this.createLangiumDocument(parseResult, uri, content);
14876         }
14877     }
14878     /**
14879      * Create a LangiumDocument from a given parse result.
14880      *
14881      * A TextDocument is created on demand if it is not provided as argument here. Usually this
14882      * should not be necessary because the main purpose of the TextDocument is to convert between
14883      * text ranges and offsets, which is done solely in LSP request handling.
14884      *
14885      * With the introduction of {@link update} below this method is supposed to be mainly called
14886      * during workspace initialization and on addition/recognition of new files, while changes in
14887      * existing documents are processed via {@link update}.
14888      */
14889     createLangiumDocument(parseResult, uri, textDocument, text) {
14890         let document;
14891         if (textDocument) {
14892             document = {
14893                 parseResult,
14894                 uri,
14895                 state: DocumentState.Parsed,
14896                 references: [],
14897                 textDocument
14898             };
14899         }
14900         else {
14901             const textDocumentGetter = this.createTextDocumentGetter(uri, text);
14902             document = {
14903                 parseResult,
14904                 uri,
14905                 state: DocumentState.Parsed,
14906                 references: [],
14907                 get textDocument() {
14908                     return textDocumentGetter();
14909                 }
14910             };
14911         }
14912         parseResult.value.$document = document;
14913         return document;
14914     }
14915     async update(document, cancellationToken) {
14916         var _a, _b;
14917         // The CST full text property contains the original text that was used to create the AST.
14918         const oldText = (_a = document.parseResult.value.$cstNode) === null || _a === void 0 ? void 0 : _a.root.fullText;
14919         const textDocument = (_b = this.textDocuments) === null || _b === void 0 ? void 0 : _b.get(document.uri.toString());
14920         const text = textDocument ? textDocument.getText() : await this.fileSystemProvider.readFile(document.uri);
14921         if (textDocument) {
14922             Object.defineProperty(document, 'textDocument', {
14923                 value: textDocument
14924             });
14925         }
14926         else {
14927             const textDocumentGetter = this.createTextDocumentGetter(document.uri, text);
14928             Object.defineProperty(document, 'textDocument', {
14929                 get: textDocumentGetter
14930             });
14931         }
14932         // Some of these documents can be pretty large, so parsing them again can be quite expensive.
14933         // Therefore, we only parse if the text has actually changed.
14934         if (oldText !== text) {
14935             document.parseResult = await this.parseAsync(document.uri, text, cancellationToken);
14936             document.parseResult.value.$document = document;
14937         }
14938         document.state = DocumentState.Parsed;
14939         return document;
14940     }
14941     parse(uri, text, options) {
14942         const services = this.serviceRegistry.getServices(uri);
14943         return services.parser.LangiumParser.parse(text, options);
14944     }
14945     parseAsync(uri, text, cancellationToken) {
14946         const services = this.serviceRegistry.getServices(uri);
14947         return services.parser.AsyncParser.parse(text, cancellationToken);
14948     }
14949     createTextDocumentGetter(uri, text) {
14950         const serviceRegistry = this.serviceRegistry;
14951         let textDoc = undefined;
14952         return () => {
14953             return textDoc !== null && textDoc !== void 0 ? textDoc : (textDoc = main_TextDocument.create(uri.toString(), serviceRegistry.getServices(uri).LanguageMetaData.languageId, 0, text !== null && text !== void 0 ? text : ''));
14954         };
14955     }
14956 }
14957 class DefaultLangiumDocuments {
14958     constructor(services) {
14959         this.documentMap = new Map();
14960         this.langiumDocumentFactory = services.workspace.LangiumDocumentFactory;
14961         this.serviceRegistry = services.ServiceRegistry;
14962     }
14963     get all() {
14964         return (0,stream/* stream */.Vw)(this.documentMap.values());
14965     }
14966     addDocument(document) {
14967         const uriString = document.uri.toString();
14968         if (this.documentMap.has(uriString)) {
14969             throw new Error(`A document with the URI '${uriString}' is already present.`);
14970         }
14971         this.documentMap.set(uriString, document);
14972     }
14973     getDocument(uri) {
14974         const uriString = uri.toString();
14975         return this.documentMap.get(uriString);
14976     }
14977     async getOrCreateDocument(uri, cancellationToken) {
14978         let document = this.getDocument(uri);
14979         if (document) {
14980             return document;
14981         }
14982         document = await this.langiumDocumentFactory.fromUri(uri, cancellationToken);
14983         this.addDocument(document);
14984         return document;
14985     }
14986     createDocument(uri, text, cancellationToken) {
14987         if (cancellationToken) {
14988             return this.langiumDocumentFactory.fromString(text, uri, cancellationToken).then(document => {
14989                 this.addDocument(document);
14990                 return document;
14991             });
14992         }
14993         else {
14994             const document = this.langiumDocumentFactory.fromString(text, uri);
14995             this.addDocument(document);
14996             return document;
14997         }
14998     }
14999     hasDocument(uri) {
15000         return this.documentMap.has(uri.toString());
15001     }
15002     invalidateDocument(uri) {
15003         const uriString = uri.toString();
15004         const langiumDoc = this.documentMap.get(uriString);
15005         if (langiumDoc) {
15006             const linker = this.serviceRegistry.getServices(uri).references.Linker;
15007             linker.unlink(langiumDoc);
15008             langiumDoc.state = DocumentState.Changed;
15009             langiumDoc.precomputedScopes = undefined;
15010             langiumDoc.diagnostics = undefined;
15011         }
15012         return langiumDoc;
15013     }
15014     deleteDocument(uri) {
15015         const uriString = uri.toString();
15016         const langiumDoc = this.documentMap.get(uriString);
15017         if (langiumDoc) {
15018             langiumDoc.state = DocumentState.Changed;
15019             this.documentMap.delete(uriString);
15020         }
15021         return langiumDoc;
15022     }
15023 }
15024 //# sourceMappingURL=documents.js.map
15025 ;// CONCATENATED MODULE: ../node_modules/langium/lib/references/linker.js
15026 /******************************************************************************
15027  * Copyright 2021 TypeFox GmbH
15028  * This program and the accompanying materials are made available under the
15029  * terms of the MIT License, which is available in the project root.
15030  ******************************************************************************/
15031 
15032 
15033 
15034 
15035 
15036 const ref_resolving = Symbol('ref_resolving');
15037 class DefaultLinker {
15038     constructor(services) {
15039         this.reflection = services.shared.AstReflection;
15040         this.langiumDocuments = () => services.shared.workspace.LangiumDocuments;
15041         this.scopeProvider = services.references.ScopeProvider;
15042         this.astNodeLocator = services.workspace.AstNodeLocator;
15043     }
15044     async link(document, cancelToken = cancellation.CancellationToken.None) {
15045         for (const node of (0,ast_utils/* streamAst */.Zc)(document.parseResult.value)) {
15046             await interruptAndCheck(cancelToken);
15047             (0,ast_utils/* streamReferences */.fy)(node).forEach(ref => this.doLink(ref, document));
15048         }
15049     }
15050     doLink(refInfo, document) {
15051         var _a;
15052         const ref = refInfo.reference;
15053         // The reference may already have been resolved lazily by accessing its `ref` property.
15054         if (ref._ref === undefined) {
15055             ref._ref = ref_resolving;
15056             try {
15057                 const description = this.getCandidate(refInfo);
15058                 if ((0,syntax_tree/* isLinkingError */.et)(description)) {
15059                     ref._ref = description;
15060                 }
15061                 else {
15062                     ref._nodeDescription = description;
15063                     if (this.langiumDocuments().hasDocument(description.documentUri)) {
15064                         // The target document is already loaded
15065                         const linkedNode = this.loadAstNode(description);
15066                         ref._ref = linkedNode !== null && linkedNode !== void 0 ? linkedNode : this.createLinkingError(refInfo, description);
15067                     }
15068                     else {
15069                         // Try to load the target AST node later using the already provided description
15070                         ref._ref = undefined;
15071                     }
15072                 }
15073             }
15074             catch (err) {
15075                 console.error(`An error occurred while resolving reference to '${ref.$refText}':`, err);
15076                 const errorMessage = (_a = err.message) !== null && _a !== void 0 ? _a : String(err);
15077                 ref._ref = Object.assign(Object.assign({}, refInfo), { message: `An error occurred while resolving reference to '${ref.$refText}': ${errorMessage}` });
15078             }
15079             // Add the reference to the document's array of references
15080             // Only add if the reference has been not been resolved earlier
15081             // Otherwise we end up with duplicates
15082             // See also implementation of `buildReference`
15083             document.references.push(ref);
15084         }
15085     }
15086     unlink(document) {
15087         for (const ref of document.references) {
15088             delete ref._ref;
15089             delete ref._nodeDescription;
15090         }
15091         document.references = [];
15092     }
15093     getCandidate(refInfo) {
15094         const scope = this.scopeProvider.getScope(refInfo);
15095         const description = scope.getElement(refInfo.reference.$refText);
15096         return description !== null && description !== void 0 ? description : this.createLinkingError(refInfo);
15097     }
15098     buildReference(node, property, refNode, refText) {
15099         // See behavior description in doc of Linker, update that on changes in here.
15100         // eslint-disable-next-line @typescript-eslint/no-this-alias
15101         const linker = this;
15102         const reference = {
15103             $refNode: refNode,
15104             $refText: refText,
15105             get ref() {
15106                 var _a;
15107                 if ((0,syntax_tree/* isAstNode */.xA)(this._ref)) {
15108                     // Most frequent case: the target is already resolved.
15109                     return this._ref;
15110                 }
15111                 else if ((0,syntax_tree/* isAstNodeDescription */.SI)(this._nodeDescription)) {
15112                     // A candidate has been found before, but it is not loaded yet.
15113                     const linkedNode = linker.loadAstNode(this._nodeDescription);
15114                     this._ref = linkedNode !== null && linkedNode !== void 0 ? linkedNode : linker.createLinkingError({ reference, container: node, property }, this._nodeDescription);
15115                 }
15116                 else if (this._ref === undefined) {
15117                     // The reference has not been linked yet, so do that now.
15118                     this._ref = ref_resolving;
15119                     const document = (0,ast_utils/* findRootNode */.E$)(node).$document;
15120                     const refData = linker.getLinkedNode({ reference, container: node, property });
15121                     if (refData.error && document && document.state < DocumentState.ComputedScopes) {
15122                         // Document scope is not ready, don't set `this._ref` so linker can retry later.
15123                         return this._ref = undefined;
15124                     }
15125                     this._ref = (_a = refData.node) !== null && _a !== void 0 ? _a : refData.error;
15126                     this._nodeDescription = refData.descr;
15127                     document === null || document === void 0 ? void 0 : document.references.push(this);
15128                 }
15129                 else if (this._ref === ref_resolving) {
15130                     throw new Error(`Cyclic reference resolution detected: ${linker.astNodeLocator.getAstNodePath(node)}/${property} (symbol '${refText}')`);
15131                 }
15132                 return (0,syntax_tree/* isAstNode */.xA)(this._ref) ? this._ref : undefined;
15133             },
15134             get $nodeDescription() {
15135                 return this._nodeDescription;
15136             },
15137             get error() {
15138                 return (0,syntax_tree/* isLinkingError */.et)(this._ref) ? this._ref : undefined;
15139             }
15140         };
15141         return reference;
15142     }
15143     getLinkedNode(refInfo) {
15144         var _a;
15145         try {
15146             const description = this.getCandidate(refInfo);
15147             if ((0,syntax_tree/* isLinkingError */.et)(description)) {
15148                 return { error: description };
15149             }
15150             const linkedNode = this.loadAstNode(description);
15151             if (linkedNode) {
15152                 return { node: linkedNode, descr: description };
15153             }
15154             else {
15155                 return {
15156                     descr: description,
15157                     error: this.createLinkingError(refInfo, description)
15158                 };
15159             }
15160         }
15161         catch (err) {
15162             console.error(`An error occurred while resolving reference to '${refInfo.reference.$refText}':`, err);
15163             const errorMessage = (_a = err.message) !== null && _a !== void 0 ? _a : String(err);
15164             return {
15165                 error: Object.assign(Object.assign({}, refInfo), { message: `An error occurred while resolving reference to '${refInfo.reference.$refText}': ${errorMessage}` })
15166             };
15167         }
15168     }
15169     loadAstNode(nodeDescription) {
15170         if (nodeDescription.node) {
15171             return nodeDescription.node;
15172         }
15173         const doc = this.langiumDocuments().getDocument(nodeDescription.documentUri);
15174         if (!doc) {
15175             return undefined;
15176         }
15177         return this.astNodeLocator.getAstNode(doc.parseResult.value, nodeDescription.path);
15178     }
15179     createLinkingError(refInfo, targetDescription) {
15180         // Check whether the document is sufficiently processed by the DocumentBuilder. If not, this is a hint for a bug
15181         // in the language implementation.
15182         const document = (0,ast_utils/* findRootNode */.E$)(refInfo.container).$document;
15183         if (document && document.state < DocumentState.ComputedScopes) {
15184             console.warn(`Attempted reference resolution before document reached ComputedScopes state (${document.uri}).`);
15185         }
15186         const referenceType = this.reflection.getReferenceType(refInfo);
15187         return Object.assign(Object.assign({}, refInfo), { message: `Could not resolve reference to ${referenceType} named '${refInfo.reference.$refText}'.`, targetDescription });
15188     }
15189 }
15190 //# sourceMappingURL=linker.js.map
15191 ;// CONCATENATED MODULE: ../node_modules/langium/lib/references/name-provider.js
15192 /******************************************************************************
15193  * Copyright 2021 TypeFox GmbH
15194  * This program and the accompanying materials are made available under the
15195  * terms of the MIT License, which is available in the project root.
15196  ******************************************************************************/
15197 
15198 function isNamed(node) {
15199     return typeof node.name === 'string';
15200 }
15201 class DefaultNameProvider {
15202     getName(node) {
15203         if (isNamed(node)) {
15204             return node.name;
15205         }
15206         return undefined;
15207     }
15208     getNameNode(node) {
15209         return (0,grammar_utils/* findNodeForProperty */.vb)(node.$cstNode, 'name');
15210     }
15211 }
15212 //# sourceMappingURL=name-provider.js.map
15213 ;// CONCATENATED MODULE: ../node_modules/langium/lib/utils/uri-utils.js
15214 /******************************************************************************
15215  * Copyright 2022 TypeFox GmbH
15216  * This program and the accompanying materials are made available under the
15217  * terms of the MIT License, which is available in the project root.
15218  ******************************************************************************/
15219 
15220 
15221 var UriUtils;
15222 (function (UriUtils) {
15223     UriUtils.basename = esm/* Utils */.c.basename;
15224     UriUtils.dirname = esm/* Utils */.c.dirname;
15225     UriUtils.extname = esm/* Utils */.c.extname;
15226     UriUtils.joinPath = esm/* Utils */.c.joinPath;
15227     UriUtils.resolvePath = esm/* Utils */.c.resolvePath;
15228     function equals(a, b) {
15229         return (a === null || a === void 0 ? void 0 : a.toString()) === (b === null || b === void 0 ? void 0 : b.toString());
15230     }
15231     UriUtils.equals = equals;
15232     function relative(from, to) {
15233         const fromPath = typeof from === 'string' ? from : from.path;
15234         const toPath = typeof to === 'string' ? to : to.path;
15235         const fromParts = fromPath.split('/').filter(e => e.length > 0);
15236         const toParts = toPath.split('/').filter(e => e.length > 0);
15237         let i = 0;
15238         for (; i < fromParts.length; i++) {
15239             if (fromParts[i] !== toParts[i]) {
15240                 break;
15241             }
15242         }
15243         const backPart = '../'.repeat(fromParts.length - i);
15244         const toPart = toParts.slice(i).join('/');
15245         return backPart + toPart;
15246     }
15247     UriUtils.relative = relative;
15248     function normalize(uri) {
15249         return esm/* URI */.o.parse(uri.toString()).toString();
15250     }
15251     UriUtils.normalize = normalize;
15252 })(UriUtils || (UriUtils = {}));
15253 //# sourceMappingURL=uri-utils.js.map
15254 ;// CONCATENATED MODULE: ../node_modules/langium/lib/references/references.js
15255 /******************************************************************************
15256  * Copyright 2021 TypeFox GmbH
15257  * This program and the accompanying materials are made available under the
15258  * terms of the MIT License, which is available in the project root.
15259  ******************************************************************************/
15260 
15261 
15262 
15263 
15264 
15265 
15266 class DefaultReferences {
15267     constructor(services) {
15268         this.nameProvider = services.references.NameProvider;
15269         this.index = services.shared.workspace.IndexManager;
15270         this.nodeLocator = services.workspace.AstNodeLocator;
15271     }
15272     findDeclaration(sourceCstNode) {
15273         if (sourceCstNode) {
15274             const assignment = (0,grammar_utils/* findAssignment */.h7)(sourceCstNode);
15275             const nodeElem = sourceCstNode.astNode;
15276             if (assignment && nodeElem) {
15277                 const reference = nodeElem[assignment.feature];
15278                 if ((0,syntax_tree/* isReference */.Yk)(reference)) {
15279                     return reference.ref;
15280                 }
15281                 else if (Array.isArray(reference)) {
15282                     for (const ref of reference) {
15283                         if ((0,syntax_tree/* isReference */.Yk)(ref) && ref.$refNode
15284                             && ref.$refNode.offset <= sourceCstNode.offset
15285                             && ref.$refNode.end >= sourceCstNode.end) {
15286                             return ref.ref;
15287                         }
15288                     }
15289                 }
15290             }
15291             if (nodeElem) {
15292                 const nameNode = this.nameProvider.getNameNode(nodeElem);
15293                 // Only return the targeted node in case the targeted cst node is the name node or part of it
15294                 if (nameNode && (nameNode === sourceCstNode || (0,cst_utils/* isChildNode */.OB)(sourceCstNode, nameNode))) {
15295                     return nodeElem;
15296                 }
15297             }
15298         }
15299         return undefined;
15300     }
15301     findDeclarationNode(sourceCstNode) {
15302         const astNode = this.findDeclaration(sourceCstNode);
15303         if (astNode === null || astNode === void 0 ? void 0 : astNode.$cstNode) {
15304             const targetNode = this.nameProvider.getNameNode(astNode);
15305             return targetNode !== null && targetNode !== void 0 ? targetNode : astNode.$cstNode;
15306         }
15307         return undefined;
15308     }
15309     findReferences(targetNode, options) {
15310         const refs = [];
15311         if (options.includeDeclaration) {
15312             const ref = this.getReferenceToSelf(targetNode);
15313             if (ref) {
15314                 refs.push(ref);
15315             }
15316         }
15317         let indexReferences = this.index.findAllReferences(targetNode, this.nodeLocator.getAstNodePath(targetNode));
15318         if (options.documentUri) {
15319             indexReferences = indexReferences.filter(ref => UriUtils.equals(ref.sourceUri, options.documentUri));
15320         }
15321         refs.push(...indexReferences);
15322         return (0,stream/* stream */.Vw)(refs);
15323     }
15324     getReferenceToSelf(targetNode) {
15325         const nameNode = this.nameProvider.getNameNode(targetNode);
15326         if (nameNode) {
15327             const doc = (0,ast_utils/* getDocument */.Me)(targetNode);
15328             const path = this.nodeLocator.getAstNodePath(targetNode);
15329             return {
15330                 sourceUri: doc.uri,
15331                 sourcePath: path,
15332                 targetUri: doc.uri,
15333                 targetPath: path,
15334                 segment: (0,cst_utils/* toDocumentSegment */.yn)(nameNode),
15335                 local: true
15336             };
15337         }
15338         return undefined;
15339     }
15340 }
15341 //# sourceMappingURL=references.js.map
15342 ;// CONCATENATED MODULE: ../node_modules/langium/lib/utils/collections.js
15343 /******************************************************************************
15344  * Copyright 2021 TypeFox GmbH
15345  * This program and the accompanying materials are made available under the
15346  * terms of the MIT License, which is available in the project root.
15347  ******************************************************************************/
15348 
15349 /**
15350  * A multimap is a variation of a Map that has potentially multiple values for every key.
15351  */
15352 class MultiMap {
15353     constructor(elements) {
15354         this.map = new Map();
15355         if (elements) {
15356             for (const [key, value] of elements) {
15357                 this.add(key, value);
15358             }
15359         }
15360     }
15361     /**
15362      * The total number of values in the multimap.
15363      */
15364     get size() {
15365         return stream/* Reduction */.IH.sum((0,stream/* stream */.Vw)(this.map.values()).map(a => a.length));
15366     }
15367     /**
15368      * Clear all entries in the multimap.
15369      */
15370     clear() {
15371         this.map.clear();
15372     }
15373     /**
15374      * Operates differently depending on whether a `value` is given:
15375      *  * With a value, this method deletes the specific key / value pair from the multimap.
15376      *  * Without a value, all values associated with the given key are deleted.
15377      *
15378      * @returns `true` if a value existed and has been removed, or `false` if the specified
15379      *     key / value does not exist.
15380      */
15381     delete(key, value) {
15382         if (value === undefined) {
15383             return this.map.delete(key);
15384         }
15385         else {
15386             const values = this.map.get(key);
15387             if (values) {
15388                 const index = values.indexOf(value);
15389                 if (index >= 0) {
15390                     if (values.length === 1) {
15391                         this.map.delete(key);
15392                     }
15393                     else {
15394                         values.splice(index, 1);
15395                     }
15396                     return true;
15397                 }
15398             }
15399             return false;
15400         }
15401     }
15402     /**
15403      * Returns an array of all values associated with the given key. If no value exists,
15404      * an empty array is returned.
15405      *
15406      * _Note:_ The returned array is assumed not to be modified. Use the `set` method to add a
15407      * value and `delete` to remove a value from the multimap.
15408      */
15409     get(key) {
15410         var _a;
15411         return (_a = this.map.get(key)) !== null && _a !== void 0 ? _a : [];
15412     }
15413     /**
15414      * Operates differently depending on whether a `value` is given:
15415      *  * With a value, this method returns `true` if the specific key / value pair is present in the multimap.
15416      *  * Without a value, this method returns `true` if the given key is present in the multimap.
15417      */
15418     has(key, value) {
15419         if (value === undefined) {
15420             return this.map.has(key);
15421         }
15422         else {
15423             const values = this.map.get(key);
15424             if (values) {
15425                 return values.indexOf(value) >= 0;
15426             }
15427             return false;
15428         }
15429     }
15430     /**
15431      * Add the given key / value pair to the multimap.
15432      */
15433     add(key, value) {
15434         if (this.map.has(key)) {
15435             this.map.get(key).push(value);
15436         }
15437         else {
15438             this.map.set(key, [value]);
15439         }
15440         return this;
15441     }
15442     /**
15443      * Add the given set of key / value pairs to the multimap.
15444      */
15445     addAll(key, values) {
15446         if (this.map.has(key)) {
15447             this.map.get(key).push(...values);
15448         }
15449         else {
15450             this.map.set(key, Array.from(values));
15451         }
15452         return this;
15453     }
15454     /**
15455      * Invokes the given callback function for every key / value pair in the multimap.
15456      */
15457     forEach(callbackfn) {
15458         this.map.forEach((array, key) => array.forEach(value => callbackfn(value, key, this)));
15459     }
15460     /**
15461      * Returns an iterator of key, value pairs for every entry in the map.
15462      */
15463     [Symbol.iterator]() {
15464         return this.entries().iterator();
15465     }
15466     /**
15467      * Returns a stream of key, value pairs for every entry in the map.
15468      */
15469     entries() {
15470         return (0,stream/* stream */.Vw)(this.map.entries())
15471             .flatMap(([key, array]) => array.map(value => [key, value]));
15472     }
15473     /**
15474      * Returns a stream of keys in the map.
15475      */
15476     keys() {
15477         return (0,stream/* stream */.Vw)(this.map.keys());
15478     }
15479     /**
15480      * Returns a stream of values in the map.
15481      */
15482     values() {
15483         return (0,stream/* stream */.Vw)(this.map.values()).flat();
15484     }
15485     /**
15486      * Returns a stream of key, value set pairs for every key in the map.
15487      */
15488     entriesGroupedByKey() {
15489         return (0,stream/* stream */.Vw)(this.map.entries());
15490     }
15491 }
15492 class BiMap {
15493     get size() {
15494         return this.map.size;
15495     }
15496     constructor(elements) {
15497         this.map = new Map();
15498         this.inverse = new Map();
15499         if (elements) {
15500             for (const [key, value] of elements) {
15501                 this.set(key, value);
15502             }
15503         }
15504     }
15505     clear() {
15506         this.map.clear();
15507         this.inverse.clear();
15508     }
15509     set(key, value) {
15510         this.map.set(key, value);
15511         this.inverse.set(value, key);
15512         return this;
15513     }
15514     get(key) {
15515         return this.map.get(key);
15516     }
15517     getKey(value) {
15518         return this.inverse.get(value);
15519     }
15520     delete(key) {
15521         const value = this.map.get(key);
15522         if (value !== undefined) {
15523             this.map.delete(key);
15524             this.inverse.delete(value);
15525             return true;
15526         }
15527         return false;
15528     }
15529 }
15530 //# sourceMappingURL=collections.js.map
15531 ;// CONCATENATED MODULE: ../node_modules/langium/lib/references/scope-computation.js
15532 /******************************************************************************
15533  * Copyright 2021-2022 TypeFox GmbH
15534  * This program and the accompanying materials are made available under the
15535  * terms of the MIT License, which is available in the project root.
15536  ******************************************************************************/
15537 
15538 
15539 
15540 
15541 /**
15542  * The default scope computation creates and collectes descriptions of the AST nodes to be exported into the
15543  * _global_ scope from the given document. By default those are the document's root AST node and its directly
15544  * contained child nodes.
15545  *
15546  * Besides, it gathers all AST nodes that have a name (according to the `NameProvider` service) and includes them
15547  * in the local scope of their particular container nodes. As a result, for every cross-reference in the AST,
15548  * target elements from the same level (siblings) and further up towards the root (parents and siblings of parents)
15549  * are visible. Elements being nested inside lower levels (children, children of siblings and parents' siblings)
15550  * are _invisible_ by default, but that can be changed by customizing this service.
15551  */
15552 class DefaultScopeComputation {
15553     constructor(services) {
15554         this.nameProvider = services.references.NameProvider;
15555         this.descriptions = services.workspace.AstNodeDescriptionProvider;
15556     }
15557     async computeExports(document, cancelToken = cancellation.CancellationToken.None) {
15558         return this.computeExportsForNode(document.parseResult.value, document, undefined, cancelToken);
15559     }
15560     /**
15561      * Creates {@link AstNodeDescription AstNodeDescriptions} for the given {@link AstNode parentNode} and its children.
15562      * The list of children to be considered is determined by the function parameter {@link children}.
15563      * By default only the direct children of {@link parentNode} are visited, nested nodes are not exported.
15564      *
15565      * @param parentNode AST node to be exported, i.e., of which an {@link AstNodeDescription} shall be added to the returned list.
15566      * @param document The document containing the AST node to be exported.
15567      * @param children A function called with {@link parentNode} as single argument and returning an {@link Iterable} supplying the children to be visited, which must be directly or transitively contained in {@link parentNode}.
15568      * @param cancelToken Indicates when to cancel the current operation.
15569      * @throws `OperationCancelled` if a user action occurs during execution.
15570      * @returns A list of {@link AstNodeDescription AstNodeDescriptions} to be published to index.
15571      */
15572     async computeExportsForNode(parentNode, document, children = ast_utils/* streamContents */.sx, cancelToken = cancellation.CancellationToken.None) {
15573         const exports = [];
15574         this.exportNode(parentNode, exports, document);
15575         for (const node of children(parentNode)) {
15576             await interruptAndCheck(cancelToken);
15577             this.exportNode(node, exports, document);
15578         }
15579         return exports;
15580     }
15581     /**
15582      * Add a single node to the list of exports if it has a name. Override this method to change how
15583      * symbols are exported, e.g. by modifying their exported name.
15584      */
15585     exportNode(node, exports, document) {
15586         const name = this.nameProvider.getName(node);
15587         if (name) {
15588             exports.push(this.descriptions.createDescription(node, name, document));
15589         }
15590     }
15591     async computeLocalScopes(document, cancelToken = cancellation.CancellationToken.None) {
15592         const rootNode = document.parseResult.value;
15593         const scopes = new MultiMap();
15594         // Here we navigate the full AST - local scopes shall be available in the whole document
15595         for (const node of (0,ast_utils/* streamAllContents */.VY)(rootNode)) {
15596             await interruptAndCheck(cancelToken);
15597             this.processNode(node, document, scopes);
15598         }
15599         return scopes;
15600     }
15601     /**
15602      * Process a single node during scopes computation. The default implementation makes the node visible
15603      * in the subtree of its container (if the node has a name). Override this method to change this,
15604      * e.g. by increasing the visibility to a higher level in the AST.
15605      */
15606     processNode(node, document, scopes) {
15607         const container = node.$container;
15608         if (container) {
15609             const name = this.nameProvider.getName(node);
15610             if (name) {
15611                 scopes.add(container, this.descriptions.createDescription(node, name, document));
15612             }
15613         }
15614     }
15615 }
15616 //# sourceMappingURL=scope-computation.js.map
15617 ;// CONCATENATED MODULE: ../node_modules/langium/lib/references/scope.js
15618 /******************************************************************************
15619  * Copyright 2023 TypeFox GmbH
15620  * This program and the accompanying materials are made available under the
15621  * terms of the MIT License, which is available in the project root.
15622  ******************************************************************************/
15623 
15624 /**
15625  * The default scope implementation is based on a `Stream`. It has an optional _outer scope_ describing
15626  * the next level of elements, which are queried when a target element is not found in the stream provided
15627  * to this scope.
15628  */
15629 class StreamScope {
15630     constructor(elements, outerScope, options) {
15631         var _a;
15632         this.elements = elements;
15633         this.outerScope = outerScope;
15634         this.caseInsensitive = (_a = options === null || options === void 0 ? void 0 : options.caseInsensitive) !== null && _a !== void 0 ? _a : false;
15635     }
15636     getAllElements() {
15637         if (this.outerScope) {
15638             return this.elements.concat(this.outerScope.getAllElements());
15639         }
15640         else {
15641             return this.elements;
15642         }
15643     }
15644     getElement(name) {
15645         const local = this.caseInsensitive
15646             ? this.elements.find(e => e.name.toLowerCase() === name.toLowerCase())
15647             : this.elements.find(e => e.name === name);
15648         if (local) {
15649             return local;
15650         }
15651         if (this.outerScope) {
15652             return this.outerScope.getElement(name);
15653         }
15654         return undefined;
15655     }
15656 }
15657 class MapScope {
15658     constructor(elements, outerScope, options) {
15659         var _a;
15660         this.elements = new Map();
15661         this.caseInsensitive = (_a = options === null || options === void 0 ? void 0 : options.caseInsensitive) !== null && _a !== void 0 ? _a : false;
15662         for (const element of elements) {
15663             const name = this.caseInsensitive
15664                 ? element.name.toLowerCase()
15665                 : element.name;
15666             this.elements.set(name, element);
15667         }
15668         this.outerScope = outerScope;
15669     }
15670     getElement(name) {
15671         const localName = this.caseInsensitive ? name.toLowerCase() : name;
15672         const local = this.elements.get(localName);
15673         if (local) {
15674             return local;
15675         }
15676         if (this.outerScope) {
15677             return this.outerScope.getElement(name);
15678         }
15679         return undefined;
15680     }
15681     getAllElements() {
15682         let elementStream = (0,stream/* stream */.Vw)(this.elements.values());
15683         if (this.outerScope) {
15684             elementStream = elementStream.concat(this.outerScope.getAllElements());
15685         }
15686         return elementStream;
15687     }
15688 }
15689 const EMPTY_SCOPE = {
15690     getElement() {
15691         return undefined;
15692     },
15693     getAllElements() {
15694         return stream/* EMPTY_STREAM */.Cl;
15695     }
15696 };
15697 //# sourceMappingURL=scope.js.map
15698 ;// CONCATENATED MODULE: ../node_modules/langium/lib/utils/caching.js
15699 /******************************************************************************
15700  * Copyright 2023 TypeFox GmbH
15701  * This program and the accompanying materials are made available under the
15702  * terms of the MIT License, which is available in the project root.
15703  ******************************************************************************/
15704 class DisposableCache {
15705     constructor() {
15706         this.toDispose = [];
15707         this.isDisposed = false;
15708     }
15709     onDispose(disposable) {
15710         this.toDispose.push(disposable);
15711     }
15712     dispose() {
15713         this.throwIfDisposed();
15714         this.clear();
15715         this.isDisposed = true;
15716         this.toDispose.forEach(disposable => disposable.dispose());
15717     }
15718     throwIfDisposed() {
15719         if (this.isDisposed) {
15720             throw new Error('This cache has already been disposed');
15721         }
15722     }
15723 }
15724 class SimpleCache extends DisposableCache {
15725     constructor() {
15726         super(...arguments);
15727         this.cache = new Map();
15728     }
15729     has(key) {
15730         this.throwIfDisposed();
15731         return this.cache.has(key);
15732     }
15733     set(key, value) {
15734         this.throwIfDisposed();
15735         this.cache.set(key, value);
15736     }
15737     get(key, provider) {
15738         this.throwIfDisposed();
15739         if (this.cache.has(key)) {
15740             return this.cache.get(key);
15741         }
15742         else if (provider) {
15743             const value = provider();
15744             this.cache.set(key, value);
15745             return value;
15746         }
15747         else {
15748             return undefined;
15749         }
15750     }
15751     delete(key) {
15752         this.throwIfDisposed();
15753         return this.cache.delete(key);
15754     }
15755     clear() {
15756         this.throwIfDisposed();
15757         this.cache.clear();
15758     }
15759 }
15760 class ContextCache extends DisposableCache {
15761     constructor(converter) {
15762         super();
15763         this.cache = new Map();
15764         this.converter = converter !== null && converter !== void 0 ? converter : (value => value);
15765     }
15766     has(contextKey, key) {
15767         this.throwIfDisposed();
15768         return this.cacheForContext(contextKey).has(key);
15769     }
15770     set(contextKey, key, value) {
15771         this.throwIfDisposed();
15772         this.cacheForContext(contextKey).set(key, value);
15773     }
15774     get(contextKey, key, provider) {
15775         this.throwIfDisposed();
15776         const contextCache = this.cacheForContext(contextKey);
15777         if (contextCache.has(key)) {
15778             return contextCache.get(key);
15779         }
15780         else if (provider) {
15781             const value = provider();
15782             contextCache.set(key, value);
15783             return value;
15784         }
15785         else {
15786             return undefined;
15787         }
15788     }
15789     delete(contextKey, key) {
15790         this.throwIfDisposed();
15791         return this.cacheForContext(contextKey).delete(key);
15792     }
15793     clear(contextKey) {
15794         this.throwIfDisposed();
15795         if (contextKey) {
15796             const mapKey = this.converter(contextKey);
15797             this.cache.delete(mapKey);
15798         }
15799         else {
15800             this.cache.clear();
15801         }
15802     }
15803     cacheForContext(contextKey) {
15804         const mapKey = this.converter(contextKey);
15805         let documentCache = this.cache.get(mapKey);
15806         if (!documentCache) {
15807             documentCache = new Map();
15808             this.cache.set(mapKey, documentCache);
15809         }
15810         return documentCache;
15811     }
15812 }
15813 /**
15814  * Every key/value pair in this cache is scoped to a document.
15815  * If this document is changed or deleted, all associated key/value pairs are deleted.
15816  */
15817 class DocumentCache extends (/* unused pure expression or super */ null && (ContextCache)) {
15818     /**
15819      * Creates a new document cache.
15820      *
15821      * @param sharedServices Service container instance to hook into document lifecycle events.
15822      * @param state Optional document state on which the cache should evict.
15823      * If not provided, the cache will evict on `DocumentBuilder#onUpdate`.
15824      * *Deleted* documents are considered in both cases.
15825      *
15826      * Providing a state here will use `DocumentBuilder#onDocumentPhase` instead,
15827      * which triggers on all documents that have been affected by this change, assuming that the
15828      * state is `DocumentState.Linked` or a later state.
15829      */
15830     constructor(sharedServices, state) {
15831         super(uri => uri.toString());
15832         if (state) {
15833             this.toDispose.push(sharedServices.workspace.DocumentBuilder.onDocumentPhase(state, document => {
15834                 this.clear(document.uri.toString());
15835             }));
15836             this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((_changed, deleted) => {
15837                 for (const uri of deleted) { // react only on deleted documents
15838                     this.clear(uri);
15839                 }
15840             }));
15841         }
15842         else {
15843             this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((changed, deleted) => {
15844                 const allUris = changed.concat(deleted); // react on both changed and deleted documents
15845                 for (const uri of allUris) {
15846                     this.clear(uri);
15847                 }
15848             }));
15849         }
15850     }
15851 }
15852 /**
15853  * Every key/value pair in this cache is scoped to the whole workspace.
15854  * If any document in the workspace is added, changed or deleted, the whole cache is evicted.
15855  */
15856 class WorkspaceCache extends SimpleCache {
15857     /**
15858      * Creates a new workspace cache.
15859      *
15860      * @param sharedServices Service container instance to hook into document lifecycle events.
15861      * @param state Optional document state on which the cache should evict.
15862      * If not provided, the cache will evict on `DocumentBuilder#onUpdate`.
15863      * *Deleted* documents are considered in both cases.
15864      */
15865     constructor(sharedServices, state) {
15866         super();
15867         if (state) {
15868             this.toDispose.push(sharedServices.workspace.DocumentBuilder.onBuildPhase(state, () => {
15869                 this.clear();
15870             }));
15871             this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((_changed, deleted) => {
15872                 if (deleted.length > 0) { // react only on deleted documents
15873                     this.clear();
15874                 }
15875             }));
15876         }
15877         else {
15878             this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate(() => {
15879                 this.clear();
15880             }));
15881         }
15882     }
15883 }
15884 //# sourceMappingURL=caching.js.map
15885 ;// CONCATENATED MODULE: ../node_modules/langium/lib/references/scope-provider.js
15886 /******************************************************************************
15887  * Copyright 2021-2022 TypeFox GmbH
15888  * This program and the accompanying materials are made available under the
15889  * terms of the MIT License, which is available in the project root.
15890  ******************************************************************************/
15891 
15892 
15893 
15894 
15895 class DefaultScopeProvider {
15896     constructor(services) {
15897         this.reflection = services.shared.AstReflection;
15898         this.nameProvider = services.references.NameProvider;
15899         this.descriptions = services.workspace.AstNodeDescriptionProvider;
15900         this.indexManager = services.shared.workspace.IndexManager;
15901         this.globalScopeCache = new WorkspaceCache(services.shared);
15902     }
15903     getScope(context) {
15904         const scopes = [];
15905         const referenceType = this.reflection.getReferenceType(context);
15906         const precomputed = (0,ast_utils/* getDocument */.Me)(context.container).precomputedScopes;
15907         if (precomputed) {
15908             let currentNode = context.container;
15909             do {
15910                 const allDescriptions = precomputed.get(currentNode);
15911                 if (allDescriptions.length > 0) {
15912                     scopes.push((0,stream/* stream */.Vw)(allDescriptions).filter(desc => this.reflection.isSubtype(desc.type, referenceType)));
15913                 }
15914                 currentNode = currentNode.$container;
15915             } while (currentNode);
15916         }
15917         let result = this.getGlobalScope(referenceType, context);
15918         for (let i = scopes.length - 1; i >= 0; i--) {
15919             result = this.createScope(scopes[i], result);
15920         }
15921         return result;
15922     }
15923     /**
15924      * Create a scope for the given collection of AST node descriptions.
15925      */
15926     createScope(elements, outerScope, options) {
15927         return new StreamScope((0,stream/* stream */.Vw)(elements), outerScope, options);
15928     }
15929     /**
15930      * Create a scope for the given collection of AST nodes, which need to be transformed into respective
15931      * descriptions first. This is done using the `NameProvider` and `AstNodeDescriptionProvider` services.
15932      */
15933     createScopeForNodes(elements, outerScope, options) {
15934         const s = (0,stream/* stream */.Vw)(elements).map(e => {
15935             const name = this.nameProvider.getName(e);
15936             if (name) {
15937                 return this.descriptions.createDescription(e, name);
15938             }
15939             return undefined;
15940         }).nonNullable();
15941         return new StreamScope(s, outerScope, options);
15942     }
15943     /**
15944      * Create a global scope filtered for the given reference type.
15945      */
15946     getGlobalScope(referenceType, _context) {
15947         return this.globalScopeCache.get(referenceType, () => new MapScope(this.indexManager.allElements(referenceType)));
15948     }
15949 }
15950 //# sourceMappingURL=scope-provider.js.map
15951 ;// CONCATENATED MODULE: ../node_modules/langium/lib/serializer/json-serializer.js
15952 /******************************************************************************
15953  * Copyright 2021 TypeFox GmbH
15954  * This program and the accompanying materials are made available under the
15955  * terms of the MIT License, which is available in the project root.
15956  ******************************************************************************/
15957 
15958 
15959 
15960 
15961 function isAstNodeWithComment(node) {
15962     return typeof node.$comment === 'string';
15963 }
15964 function isIntermediateReference(obj) {
15965     return typeof obj === 'object' && !!obj && ('$ref' in obj || '$error' in obj);
15966 }
15967 class DefaultJsonSerializer {
15968     constructor(services) {
15969         /** The set of AstNode properties to be ignored by the serializer. */
15970         this.ignoreProperties = new Set(['$container', '$containerProperty', '$containerIndex', '$document', '$cstNode']);
15971         this.langiumDocuments = services.shared.workspace.LangiumDocuments;
15972         this.astNodeLocator = services.workspace.AstNodeLocator;
15973         this.nameProvider = services.references.NameProvider;
15974         this.commentProvider = services.documentation.CommentProvider;
15975     }
15976     serialize(node, options) {
15977         const serializeOptions = options !== null && options !== void 0 ? options : {};
15978         const specificReplacer = options === null || options === void 0 ? void 0 : options.replacer;
15979         const defaultReplacer = (key, value) => this.replacer(key, value, serializeOptions);
15980         const replacer = specificReplacer ? (key, value) => specificReplacer(key, value, defaultReplacer) : defaultReplacer;
15981         try {
15982             this.currentDocument = (0,ast_utils/* getDocument */.Me)(node);
15983             return JSON.stringify(node, replacer, options === null || options === void 0 ? void 0 : options.space);
15984         }
15985         finally {
15986             this.currentDocument = undefined;
15987         }
15988     }
15989     deserialize(content, options) {
15990         const deserializeOptions = options !== null && options !== void 0 ? options : {};
15991         const root = JSON.parse(content);
15992         this.linkNode(root, root, deserializeOptions);
15993         return root;
15994     }
15995     replacer(key, value, { refText, sourceText, textRegions, comments, uriConverter }) {
15996         var _a, _b, _c, _d;
15997         if (this.ignoreProperties.has(key)) {
15998             return undefined;
15999         }
16000         else if ((0,syntax_tree/* isReference */.Yk)(value)) {
16001             const refValue = value.ref;
16002             const $refText = refText ? value.$refText : undefined;
16003             if (refValue) {
16004                 const targetDocument = (0,ast_utils/* getDocument */.Me)(refValue);
16005                 let targetUri = '';
16006                 if (this.currentDocument && this.currentDocument !== targetDocument) {
16007                     if (uriConverter) {
16008                         targetUri = uriConverter(targetDocument.uri, value);
16009                     }
16010                     else {
16011                         targetUri = targetDocument.uri.toString();
16012                     }
16013                 }
16014                 const targetPath = this.astNodeLocator.getAstNodePath(refValue);
16015                 return {
16016                     $ref: `${targetUri}#${targetPath}`,
16017                     $refText
16018                 };
16019             }
16020             else {
16021                 return {
16022                     $error: (_b = (_a = value.error) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : 'Could not resolve reference',
16023                     $refText
16024                 };
16025             }
16026         }
16027         else if ((0,syntax_tree/* isAstNode */.xA)(value)) {
16028             let astNode = undefined;
16029             if (textRegions) {
16030                 astNode = this.addAstNodeRegionWithAssignmentsTo(Object.assign({}, value));
16031                 if ((!key || value.$document) && (astNode === null || astNode === void 0 ? void 0 : astNode.$textRegion)) {
16032                     // The document URI is added to the root node of the resulting JSON tree
16033                     astNode.$textRegion.documentURI = (_c = this.currentDocument) === null || _c === void 0 ? void 0 : _c.uri.toString();
16034                 }
16035             }
16036             if (sourceText && !key) {
16037                 astNode !== null && astNode !== void 0 ? astNode : (astNode = Object.assign({}, value));
16038                 astNode.$sourceText = (_d = value.$cstNode) === null || _d === void 0 ? void 0 : _d.text;
16039             }
16040             if (comments) {
16041                 astNode !== null && astNode !== void 0 ? astNode : (astNode = Object.assign({}, value));
16042                 const comment = this.commentProvider.getComment(value);
16043                 if (comment) {
16044                     astNode.$comment = comment.replace(/\r/g, '');
16045                 }
16046             }
16047             return astNode !== null && astNode !== void 0 ? astNode : value;
16048         }
16049         else {
16050             return value;
16051         }
16052     }
16053     addAstNodeRegionWithAssignmentsTo(node) {
16054         const createDocumentSegment = cstNode => ({
16055             offset: cstNode.offset,
16056             end: cstNode.end,
16057             length: cstNode.length,
16058             range: cstNode.range,
16059         });
16060         if (node.$cstNode) {
16061             const textRegion = node.$textRegion = createDocumentSegment(node.$cstNode);
16062             const assignments = textRegion.assignments = {};
16063             Object.keys(node).filter(key => !key.startsWith('$')).forEach(key => {
16064                 const propertyAssignments = (0,grammar_utils/* findNodesForProperty */.EL)(node.$cstNode, key).map(createDocumentSegment);
16065                 if (propertyAssignments.length !== 0) {
16066                     assignments[key] = propertyAssignments;
16067                 }
16068             });
16069             return node;
16070         }
16071         return undefined;
16072     }
16073     linkNode(node, root, options, container, containerProperty, containerIndex) {
16074         for (const [propertyName, item] of Object.entries(node)) {
16075             if (Array.isArray(item)) {
16076                 for (let index = 0; index < item.length; index++) {
16077                     const element = item[index];
16078                     if (isIntermediateReference(element)) {
16079                         item[index] = this.reviveReference(node, propertyName, root, element, options);
16080                     }
16081                     else if ((0,syntax_tree/* isAstNode */.xA)(element)) {
16082                         this.linkNode(element, root, options, node, propertyName, index);
16083                     }
16084                 }
16085             }
16086             else if (isIntermediateReference(item)) {
16087                 node[propertyName] = this.reviveReference(node, propertyName, root, item, options);
16088             }
16089             else if ((0,syntax_tree/* isAstNode */.xA)(item)) {
16090                 this.linkNode(item, root, options, node, propertyName);
16091             }
16092         }
16093         const mutable = node;
16094         mutable.$container = container;
16095         mutable.$containerProperty = containerProperty;
16096         mutable.$containerIndex = containerIndex;
16097     }
16098     reviveReference(container, property, root, reference, options) {
16099         let refText = reference.$refText;
16100         let error = reference.$error;
16101         if (reference.$ref) {
16102             const ref = this.getRefNode(root, reference.$ref, options.uriConverter);
16103             if ((0,syntax_tree/* isAstNode */.xA)(ref)) {
16104                 if (!refText) {
16105                     refText = this.nameProvider.getName(ref);
16106                 }
16107                 return {
16108                     $refText: refText !== null && refText !== void 0 ? refText : '',
16109                     ref
16110                 };
16111             }
16112             else {
16113                 error = ref;
16114             }
16115         }
16116         if (error) {
16117             const ref = {
16118                 $refText: refText !== null && refText !== void 0 ? refText : ''
16119             };
16120             ref.error = {
16121                 container,
16122                 property,
16123                 message: error,
16124                 reference: ref
16125             };
16126             return ref;
16127         }
16128         else {
16129             return undefined;
16130         }
16131     }
16132     getRefNode(root, uri, uriConverter) {
16133         try {
16134             const fragmentIndex = uri.indexOf('#');
16135             if (fragmentIndex === 0) {
16136                 const node = this.astNodeLocator.getAstNode(root, uri.substring(1));
16137                 if (!node) {
16138                     return 'Could not resolve path: ' + uri;
16139                 }
16140                 return node;
16141             }
16142             if (fragmentIndex < 0) {
16143                 const documentUri = uriConverter ? uriConverter(uri) : esm/* URI */.o.parse(uri);
16144                 const document = this.langiumDocuments.getDocument(documentUri);
16145                 if (!document) {
16146                     return 'Could not find document for URI: ' + uri;
16147                 }
16148                 return document.parseResult.value;
16149             }
16150             const documentUri = uriConverter ? uriConverter(uri.substring(0, fragmentIndex)) : esm/* URI */.o.parse(uri.substring(0, fragmentIndex));
16151             const document = this.langiumDocuments.getDocument(documentUri);
16152             if (!document) {
16153                 return 'Could not find document for URI: ' + uri;
16154             }
16155             if (fragmentIndex === uri.length - 1) {
16156                 return document.parseResult.value;
16157             }
16158             const node = this.astNodeLocator.getAstNode(document.parseResult.value, uri.substring(fragmentIndex + 1));
16159             if (!node) {
16160                 return 'Could not resolve URI: ' + uri;
16161             }
16162             return node;
16163         }
16164         catch (err) {
16165             return String(err);
16166         }
16167     }
16168 }
16169 //# sourceMappingURL=json-serializer.js.map
16170 ;// CONCATENATED MODULE: ../node_modules/langium/lib/service-registry.js
16171 /******************************************************************************
16172  * Copyright 2021 TypeFox GmbH
16173  * This program and the accompanying materials are made available under the
16174  * terms of the MIT License, which is available in the project root.
16175  ******************************************************************************/
16176 
16177 /**
16178  * Generic registry for Langium services, but capable of being used with extending service sets as well (such as the lsp-complete LangiumCoreServices set)
16179  */
16180 class DefaultServiceRegistry {
16181     /**
16182      * @deprecated Use the new `fileExtensionMap` (or `languageIdMap`) property instead.
16183      */
16184     get map() {
16185         return this.fileExtensionMap;
16186     }
16187     constructor(services) {
16188         this.languageIdMap = new Map();
16189         this.fileExtensionMap = new Map();
16190         this.textDocuments = services === null || services === void 0 ? void 0 : services.workspace.TextDocuments;
16191     }
16192     register(language) {
16193         const data = language.LanguageMetaData;
16194         for (const ext of data.fileExtensions) {
16195             if (this.fileExtensionMap.has(ext)) {
16196                 console.warn(`The file extension ${ext} is used by multiple languages. It is now assigned to '${data.languageId}'.`);
16197             }
16198             this.fileExtensionMap.set(ext, language);
16199         }
16200         this.languageIdMap.set(data.languageId, language);
16201         if (this.languageIdMap.size === 1) {
16202             this.singleton = language;
16203         }
16204         else {
16205             this.singleton = undefined;
16206         }
16207     }
16208     getServices(uri) {
16209         var _a, _b;
16210         if (this.singleton !== undefined) {
16211             return this.singleton;
16212         }
16213         if (this.languageIdMap.size === 0) {
16214             throw new Error('The service registry is empty. Use `register` to register the services of a language.');
16215         }
16216         const languageId = (_b = (_a = this.textDocuments) === null || _a === void 0 ? void 0 : _a.get(uri)) === null || _b === void 0 ? void 0 : _b.languageId;
16217         if (languageId !== undefined) {
16218             const services = this.languageIdMap.get(languageId);
16219             if (services) {
16220                 return services;
16221             }
16222         }
16223         const ext = UriUtils.extname(uri);
16224         const services = this.fileExtensionMap.get(ext);
16225         if (!services) {
16226             if (languageId) {
16227                 throw new Error(`The service registry contains no services for the extension '${ext}' for language '${languageId}'.`);
16228             }
16229             else {
16230                 throw new Error(`The service registry contains no services for the extension '${ext}'.`);
16231             }
16232         }
16233         return services;
16234     }
16235     hasServices(uri) {
16236         try {
16237             this.getServices(uri);
16238             return true;
16239         }
16240         catch (_a) {
16241             return false;
16242         }
16243     }
16244     get all() {
16245         return Array.from(this.languageIdMap.values());
16246     }
16247 }
16248 //# sourceMappingURL=service-registry.js.map
16249 ;// CONCATENATED MODULE: ../node_modules/langium/lib/validation/validation-registry.js
16250 /******************************************************************************
16251  * Copyright 2021 TypeFox GmbH
16252  * This program and the accompanying materials are made available under the
16253  * terms of the MIT License, which is available in the project root.
16254  ******************************************************************************/
16255 
16256 
16257 
16258 
16259 /**
16260  * Create DiagnosticData for a given diagnostic code. The result can be put into the `data` field of a DiagnosticInfo.
16261  */
16262 function diagnosticData(code) {
16263     return { code };
16264 }
16265 var ValidationCategory;
16266 (function (ValidationCategory) {
16267     ValidationCategory.all = ['fast', 'slow', 'built-in'];
16268 })(ValidationCategory || (ValidationCategory = {}));
16269 /**
16270  * Manages a set of `ValidationCheck`s to be applied when documents are validated.
16271  */
16272 class ValidationRegistry {
16273     constructor(services) {
16274         this.entries = new MultiMap();
16275         this.entriesBefore = [];
16276         this.entriesAfter = [];
16277         this.reflection = services.shared.AstReflection;
16278     }
16279     /**
16280      * Register a set of validation checks. Each value in the record can be either a single validation check (i.e. a function)
16281      * or an array of validation checks.
16282      *
16283      * @param checksRecord Set of validation checks to register.
16284      * @param category Optional category for the validation checks (defaults to `'fast'`).
16285      * @param thisObj Optional object to be used as `this` when calling the validation check functions.
16286      */
16287     register(checksRecord, thisObj = this, category = 'fast') {
16288         if (category === 'built-in') {
16289             throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");
16290         }
16291         for (const [type, ch] of Object.entries(checksRecord)) {
16292             const callbacks = ch;
16293             if (Array.isArray(callbacks)) {
16294                 for (const check of callbacks) {
16295                     const entry = {
16296                         check: this.wrapValidationException(check, thisObj),
16297                         category
16298                     };
16299                     this.addEntry(type, entry);
16300                 }
16301             }
16302             else if (typeof callbacks === 'function') {
16303                 const entry = {
16304                     check: this.wrapValidationException(callbacks, thisObj),
16305                     category
16306                 };
16307                 this.addEntry(type, entry);
16308             }
16309             else {
16310                 (0,errors/* assertUnreachable */.U)(callbacks);
16311             }
16312         }
16313     }
16314     wrapValidationException(check, thisObj) {
16315         return async (node, accept, cancelToken) => {
16316             await this.handleException(() => check.call(thisObj, node, accept, cancelToken), 'An error occurred during validation', accept, node);
16317         };
16318     }
16319     async handleException(functionality, messageContext, accept, node) {
16320         try {
16321             await functionality();
16322         }
16323         catch (err) {
16324             if (isOperationCancelled(err)) {
16325                 throw err;
16326             }
16327             console.error(`${messageContext}:`, err);
16328             if (err instanceof Error && err.stack) {
16329                 console.error(err.stack);
16330             }
16331             const messageDetails = err instanceof Error ? err.message : String(err);
16332             accept('error', `${messageContext}: ${messageDetails}`, { node });
16333         }
16334     }
16335     addEntry(type, entry) {
16336         if (type === 'AstNode') {
16337             this.entries.add('AstNode', entry);
16338             return;
16339         }
16340         for (const subtype of this.reflection.getAllSubTypes(type)) {
16341             this.entries.add(subtype, entry);
16342         }
16343     }
16344     getChecks(type, categories) {
16345         let checks = (0,stream/* stream */.Vw)(this.entries.get(type))
16346             .concat(this.entries.get('AstNode'));
16347         if (categories) {
16348             checks = checks.filter(entry => categories.includes(entry.category));
16349         }
16350         return checks.map(entry => entry.check);
16351     }
16352     /**
16353      * Register logic which will be executed once before validating all the nodes of an AST/Langium document.
16354      * This helps to prepare or initialize some information which are required or reusable for the following checks on the AstNodes.
16355      *
16356      * As an example, for validating unique fully-qualified names of nodes in the AST,
16357      * here the map for mapping names to nodes could be established.
16358      * During the usual checks on the nodes, they are put into this map with their name.
16359      *
16360      * Note that this approach makes validations stateful, which is relevant e.g. when cancelling the validation.
16361      * Therefore it is recommended to clear stored information
16362      * _before_ validating an AST to validate each AST unaffected from other ASTs
16363      * AND _after_ validating the AST to free memory by information which are no longer used.
16364      *
16365      * @param checkBefore a set-up function which will be called once before actually validating an AST
16366      * @param thisObj Optional object to be used as `this` when calling the validation check functions.
16367      */
16368     registerBeforeDocument(checkBefore, thisObj = this) {
16369         this.entriesBefore.push(this.wrapPreparationException(checkBefore, 'An error occurred during set-up of the validation', thisObj));
16370     }
16371     /**
16372      * Register logic which will be executed once after validating all the nodes of an AST/Langium document.
16373      * This helps to finally evaluate information which are collected during the checks on the AstNodes.
16374      *
16375      * As an example, for validating unique fully-qualified names of nodes in the AST,
16376      * here the map with all the collected nodes and their names is checked
16377      * and validation hints are created for all nodes with the same name.
16378      *
16379      * Note that this approach makes validations stateful, which is relevant e.g. when cancelling the validation.
16380      * Therefore it is recommended to clear stored information
16381      * _before_ validating an AST to validate each AST unaffected from other ASTs
16382      * AND _after_ validating the AST to free memory by information which are no longer used.
16383      *
16384      * @param checkBefore a set-up function which will be called once before actually validating an AST
16385      * @param thisObj Optional object to be used as `this` when calling the validation check functions.
16386      */
16387     registerAfterDocument(checkAfter, thisObj = this) {
16388         this.entriesAfter.push(this.wrapPreparationException(checkAfter, 'An error occurred during tear-down of the validation', thisObj));
16389     }
16390     wrapPreparationException(check, messageContext, thisObj) {
16391         return async (rootNode, accept, categories, cancelToken) => {
16392             await this.handleException(() => check.call(thisObj, rootNode, accept, categories, cancelToken), messageContext, accept, rootNode);
16393         };
16394     }
16395     get checksBefore() {
16396         return this.entriesBefore;
16397     }
16398     get checksAfter() {
16399         return this.entriesAfter;
16400     }
16401 }
16402 //# sourceMappingURL=validation-registry.js.map
16403 ;// CONCATENATED MODULE: ../node_modules/langium/lib/validation/document-validator.js
16404 /******************************************************************************
16405  * Copyright 2021 TypeFox GmbH
16406  * This program and the accompanying materials are made available under the
16407  * terms of the MIT License, which is available in the project root.
16408  ******************************************************************************/
16409 
16410 
16411 
16412 
16413 
16414 
16415 class DefaultDocumentValidator {
16416     constructor(services) {
16417         this.validationRegistry = services.validation.ValidationRegistry;
16418         this.metadata = services.LanguageMetaData;
16419     }
16420     async validateDocument(document, options = {}, cancelToken = cancellation.CancellationToken.None) {
16421         const parseResult = document.parseResult;
16422         const diagnostics = [];
16423         await interruptAndCheck(cancelToken);
16424         if (!options.categories || options.categories.includes('built-in')) {
16425             this.processLexingErrors(parseResult, diagnostics, options);
16426             if (options.stopAfterLexingErrors && diagnostics.some(d => { var _a; return ((_a = d.data) === null || _a === void 0 ? void 0 : _a.code) === DocumentValidator.LexingError; })) {
16427                 return diagnostics;
16428             }
16429             this.processParsingErrors(parseResult, diagnostics, options);
16430             if (options.stopAfterParsingErrors && diagnostics.some(d => { var _a; return ((_a = d.data) === null || _a === void 0 ? void 0 : _a.code) === DocumentValidator.ParsingError; })) {
16431                 return diagnostics;
16432             }
16433             this.processLinkingErrors(document, diagnostics, options);
16434             if (options.stopAfterLinkingErrors && diagnostics.some(d => { var _a; return ((_a = d.data) === null || _a === void 0 ? void 0 : _a.code) === DocumentValidator.LinkingError; })) {
16435                 return diagnostics;
16436             }
16437         }
16438         // Process custom validations
16439         try {
16440             diagnostics.push(...await this.validateAst(parseResult.value, options, cancelToken));
16441         }
16442         catch (err) {
16443             if (isOperationCancelled(err)) {
16444                 throw err;
16445             }
16446             console.error('An error occurred during validation:', err);
16447         }
16448         await interruptAndCheck(cancelToken);
16449         return diagnostics;
16450     }
16451     processLexingErrors(parseResult, diagnostics, _options) {
16452         var _a, _b, _c;
16453         const lexerDiagnostics = [...parseResult.lexerErrors, ...(_b = (_a = parseResult.lexerReport) === null || _a === void 0 ? void 0 : _a.diagnostics) !== null && _b !== void 0 ? _b : []];
16454         for (const lexerDiagnostic of lexerDiagnostics) {
16455             const severity = (_c = lexerDiagnostic.severity) !== null && _c !== void 0 ? _c : 'error';
16456             const diagnostic = {
16457                 severity: toDiagnosticSeverity(severity),
16458                 range: {
16459                     start: {
16460                         line: lexerDiagnostic.line - 1,
16461                         character: lexerDiagnostic.column - 1
16462                     },
16463                     end: {
16464                         line: lexerDiagnostic.line - 1,
16465                         character: lexerDiagnostic.column + lexerDiagnostic.length - 1
16466                     }
16467                 },
16468                 message: lexerDiagnostic.message,
16469                 data: toDiagnosticData(severity),
16470                 source: this.getSource()
16471             };
16472             diagnostics.push(diagnostic);
16473         }
16474     }
16475     processParsingErrors(parseResult, diagnostics, _options) {
16476         for (const parserError of parseResult.parserErrors) {
16477             let range = undefined;
16478             // We can run into the chevrotain error recovery here
16479             // The token contained in the parser error might be automatically inserted
16480             // In this case every position value will be `NaN`
16481             if (isNaN(parserError.token.startOffset)) {
16482                 // Some special parser error types contain a `previousToken`
16483                 // We can simply append our diagnostic to that token
16484                 if ('previousToken' in parserError) {
16485                     const token = parserError.previousToken;
16486                     if (!isNaN(token.startOffset)) {
16487                         const position = { line: token.endLine - 1, character: token.endColumn };
16488                         range = { start: position, end: position };
16489                     }
16490                     else {
16491                         // No valid prev token. Might be empty document or containing only hidden tokens.
16492                         // Point to document start
16493                         const position = { line: 0, character: 0 };
16494                         range = { start: position, end: position };
16495                     }
16496                 }
16497             }
16498             else {
16499                 range = (0,cst_utils/* tokenToRange */.sp)(parserError.token);
16500             }
16501             if (range) {
16502                 const diagnostic = {
16503                     severity: toDiagnosticSeverity('error'),
16504                     range,
16505                     message: parserError.message,
16506                     data: diagnosticData(DocumentValidator.ParsingError),
16507                     source: this.getSource()
16508                 };
16509                 diagnostics.push(diagnostic);
16510             }
16511         }
16512     }
16513     processLinkingErrors(document, diagnostics, _options) {
16514         for (const reference of document.references) {
16515             const linkingError = reference.error;
16516             if (linkingError) {
16517                 const info = {
16518                     node: linkingError.container,
16519                     property: linkingError.property,
16520                     index: linkingError.index,
16521                     data: {
16522                         code: DocumentValidator.LinkingError,
16523                         containerType: linkingError.container.$type,
16524                         property: linkingError.property,
16525                         refText: linkingError.reference.$refText
16526                     }
16527                 };
16528                 diagnostics.push(this.toDiagnostic('error', linkingError.message, info));
16529             }
16530         }
16531     }
16532     async validateAst(rootNode, options, cancelToken = cancellation.CancellationToken.None) {
16533         const validationItems = [];
16534         const acceptor = (severity, message, info) => {
16535             validationItems.push(this.toDiagnostic(severity, message, info));
16536         };
16537         await this.validateAstBefore(rootNode, options, acceptor, cancelToken);
16538         await this.validateAstNodes(rootNode, options, acceptor, cancelToken);
16539         await this.validateAstAfter(rootNode, options, acceptor, cancelToken);
16540         return validationItems;
16541     }
16542     async validateAstBefore(rootNode, options, acceptor, cancelToken = cancellation.CancellationToken.None) {
16543         var _a;
16544         const checksBefore = this.validationRegistry.checksBefore;
16545         for (const checkBefore of checksBefore) {
16546             await interruptAndCheck(cancelToken);
16547             await checkBefore(rootNode, acceptor, (_a = options.categories) !== null && _a !== void 0 ? _a : [], cancelToken);
16548         }
16549     }
16550     async validateAstNodes(rootNode, options, acceptor, cancelToken = cancellation.CancellationToken.None) {
16551         await Promise.all((0,ast_utils/* streamAst */.Zc)(rootNode).map(async (node) => {
16552             await interruptAndCheck(cancelToken);
16553             const checks = this.validationRegistry.getChecks(node.$type, options.categories);
16554             for (const check of checks) {
16555                 await check(node, acceptor, cancelToken);
16556             }
16557         }));
16558     }
16559     async validateAstAfter(rootNode, options, acceptor, cancelToken = cancellation.CancellationToken.None) {
16560         var _a;
16561         const checksAfter = this.validationRegistry.checksAfter;
16562         for (const checkAfter of checksAfter) {
16563             await interruptAndCheck(cancelToken);
16564             await checkAfter(rootNode, acceptor, (_a = options.categories) !== null && _a !== void 0 ? _a : [], cancelToken);
16565         }
16566     }
16567     toDiagnostic(severity, message, info) {
16568         return {
16569             message,
16570             range: getDiagnosticRange(info),
16571             severity: toDiagnosticSeverity(severity),
16572             code: info.code,
16573             codeDescription: info.codeDescription,
16574             tags: info.tags,
16575             relatedInformation: info.relatedInformation,
16576             data: info.data,
16577             source: this.getSource()
16578         };
16579     }
16580     getSource() {
16581         return this.metadata.languageId;
16582     }
16583 }
16584 function getDiagnosticRange(info) {
16585     if (info.range) {
16586         return info.range;
16587     }
16588     let cstNode;
16589     if (typeof info.property === 'string') {
16590         cstNode = (0,grammar_utils/* findNodeForProperty */.vb)(info.node.$cstNode, info.property, info.index);
16591     }
16592     else if (typeof info.keyword === 'string') {
16593         cstNode = (0,grammar_utils/* findNodeForKeyword */.lA)(info.node.$cstNode, info.keyword, info.index);
16594     }
16595     cstNode !== null && cstNode !== void 0 ? cstNode : (cstNode = info.node.$cstNode);
16596     if (!cstNode) {
16597         return {
16598             start: { line: 0, character: 0 },
16599             end: { line: 0, character: 0 }
16600         };
16601     }
16602     return cstNode.range;
16603 }
16604 /**
16605  * Transforms the diagnostic severity from the {@link LexingDiagnosticSeverity} format to LSP's `DiagnosticSeverity` format.
16606  *
16607  * @param severity The lexing diagnostic severity
16608  * @returns Diagnostic severity according to `vscode-languageserver-types/lib/esm/main.js#DiagnosticSeverity`
16609  */
16610 function toDiagnosticSeverity(severity) {
16611     switch (severity) {
16612         case 'error':
16613             return 1;
16614         case 'warning':
16615             return 2;
16616         case 'info':
16617             return 3;
16618         case 'hint':
16619             return 4;
16620         default:
16621             throw new Error('Invalid diagnostic severity: ' + severity);
16622     }
16623 }
16624 function toDiagnosticData(severity) {
16625     switch (severity) {
16626         case 'error':
16627             return diagnosticData(DocumentValidator.LexingError);
16628         case 'warning':
16629             return diagnosticData(DocumentValidator.LexingWarning);
16630         case 'info':
16631             return diagnosticData(DocumentValidator.LexingInfo);
16632         case 'hint':
16633             return diagnosticData(DocumentValidator.LexingHint);
16634         default:
16635             throw new Error('Invalid diagnostic severity: ' + severity);
16636     }
16637 }
16638 var DocumentValidator;
16639 (function (DocumentValidator) {
16640     DocumentValidator.LexingError = 'lexing-error';
16641     DocumentValidator.LexingWarning = 'lexing-warning';
16642     DocumentValidator.LexingInfo = 'lexing-info';
16643     DocumentValidator.LexingHint = 'lexing-hint';
16644     DocumentValidator.ParsingError = 'parsing-error';
16645     DocumentValidator.LinkingError = 'linking-error';
16646 })(DocumentValidator || (DocumentValidator = {}));
16647 //# sourceMappingURL=document-validator.js.map
16648 ;// CONCATENATED MODULE: ../node_modules/langium/lib/workspace/ast-descriptions.js
16649 /******************************************************************************
16650  * Copyright 2021 TypeFox GmbH
16651  * This program and the accompanying materials are made available under the
16652  * terms of the MIT License, which is available in the project root.
16653  ******************************************************************************/
16654 
16655 
16656 
16657 
16658 
16659 
16660 class DefaultAstNodeDescriptionProvider {
16661     constructor(services) {
16662         this.astNodeLocator = services.workspace.AstNodeLocator;
16663         this.nameProvider = services.references.NameProvider;
16664     }
16665     createDescription(node, name, document) {
16666         const doc = document !== null && document !== void 0 ? document : (0,ast_utils/* getDocument */.Me)(node);
16667         name !== null && name !== void 0 ? name : (name = this.nameProvider.getName(node));
16668         const path = this.astNodeLocator.getAstNodePath(node);
16669         if (!name) {
16670             throw new Error(`Node at path ${path} has no name.`);
16671         }
16672         let nameNodeSegment;
16673         const nameSegmentGetter = () => { var _a; return nameNodeSegment !== null && nameNodeSegment !== void 0 ? nameNodeSegment : (nameNodeSegment = (0,cst_utils/* toDocumentSegment */.yn)((_a = this.nameProvider.getNameNode(node)) !== null && _a !== void 0 ? _a : node.$cstNode)); };
16674         return {
16675             node,
16676             name,
16677             get nameSegment() {
16678                 return nameSegmentGetter();
16679             },
16680             selectionSegment: (0,cst_utils/* toDocumentSegment */.yn)(node.$cstNode),
16681             type: node.$type,
16682             documentUri: doc.uri,
16683             path
16684         };
16685     }
16686 }
16687 class DefaultReferenceDescriptionProvider {
16688     constructor(services) {
16689         this.nodeLocator = services.workspace.AstNodeLocator;
16690     }
16691     async createDescriptions(document, cancelToken = cancellation.CancellationToken.None) {
16692         const descr = [];
16693         const rootNode = document.parseResult.value;
16694         for (const astNode of (0,ast_utils/* streamAst */.Zc)(rootNode)) {
16695             await interruptAndCheck(cancelToken);
16696             (0,ast_utils/* streamReferences */.fy)(astNode).filter(refInfo => !(0,syntax_tree/* isLinkingError */.et)(refInfo)).forEach(refInfo => {
16697                 // TODO: Consider logging a warning or throw an exception when DocumentState is < than Linked
16698                 const description = this.createDescription(refInfo);
16699                 if (description) {
16700                     descr.push(description);
16701                 }
16702             });
16703         }
16704         return descr;
16705     }
16706     createDescription(refInfo) {
16707         const targetNodeDescr = refInfo.reference.$nodeDescription;
16708         const refCstNode = refInfo.reference.$refNode;
16709         if (!targetNodeDescr || !refCstNode) {
16710             return undefined;
16711         }
16712         const docUri = (0,ast_utils/* getDocument */.Me)(refInfo.container).uri;
16713         return {
16714             sourceUri: docUri,
16715             sourcePath: this.nodeLocator.getAstNodePath(refInfo.container),
16716             targetUri: targetNodeDescr.documentUri,
16717             targetPath: targetNodeDescr.path,
16718             segment: (0,cst_utils/* toDocumentSegment */.yn)(refCstNode),
16719             local: UriUtils.equals(targetNodeDescr.documentUri, docUri)
16720         };
16721     }
16722 }
16723 //# sourceMappingURL=ast-descriptions.js.map
16724 ;// CONCATENATED MODULE: ../node_modules/langium/lib/workspace/ast-node-locator.js
16725 /******************************************************************************
16726  * Copyright 2021 TypeFox GmbH
16727  * This program and the accompanying materials are made available under the
16728  * terms of the MIT License, which is available in the project root.
16729  ******************************************************************************/
16730 class DefaultAstNodeLocator {
16731     constructor() {
16732         this.segmentSeparator = '/';
16733         this.indexSeparator = '@';
16734     }
16735     getAstNodePath(node) {
16736         if (node.$container) {
16737             const containerPath = this.getAstNodePath(node.$container);
16738             const newSegment = this.getPathSegment(node);
16739             const nodePath = containerPath + this.segmentSeparator + newSegment;
16740             return nodePath;
16741         }
16742         return '';
16743     }
16744     getPathSegment({ $containerProperty, $containerIndex }) {
16745         if (!$containerProperty) {
16746             throw new Error("Missing '$containerProperty' in AST node.");
16747         }
16748         if ($containerIndex !== undefined) {
16749             return $containerProperty + this.indexSeparator + $containerIndex;
16750         }
16751         return $containerProperty;
16752     }
16753     getAstNode(node, path) {
16754         const segments = path.split(this.segmentSeparator);
16755         return segments.reduce((previousValue, currentValue) => {
16756             if (!previousValue || currentValue.length === 0) {
16757                 return previousValue;
16758             }
16759             const propertyIndex = currentValue.indexOf(this.indexSeparator);
16760             if (propertyIndex > 0) {
16761                 const property = currentValue.substring(0, propertyIndex);
16762                 const arrayIndex = parseInt(currentValue.substring(propertyIndex + 1));
16763                 const array = previousValue[property];
16764                 return array === null || array === void 0 ? void 0 : array[arrayIndex];
16765             }
16766             return previousValue[currentValue];
16767         }, node);
16768     }
16769 }
16770 //# sourceMappingURL=ast-node-locator.js.map
16771 // EXTERNAL MODULE: ../node_modules/vscode-jsonrpc/lib/common/events.js
16772 var events = __webpack_require__(345);
16773 ;// CONCATENATED MODULE: ../node_modules/langium/lib/workspace/configuration.js
16774 /******************************************************************************
16775  * Copyright 2022 TypeFox GmbH
16776  * This program and the accompanying materials are made available under the
16777  * terms of the MIT License, which is available in the project root.
16778  ******************************************************************************/
16779 
16780 
16781 /**
16782  * Base configuration provider for building up other configuration providers
16783  */
16784 class DefaultConfigurationProvider {
16785     constructor(services) {
16786         this._ready = new promise_utils_Deferred();
16787         this.settings = {};
16788         this.workspaceConfig = false;
16789         this.onConfigurationSectionUpdateEmitter = new events.Emitter();
16790         this.serviceRegistry = services.ServiceRegistry;
16791     }
16792     get ready() {
16793         return this._ready.promise;
16794     }
16795     initialize(params) {
16796         var _a, _b;
16797         this.workspaceConfig = (_b = (_a = params.capabilities.workspace) === null || _a === void 0 ? void 0 : _a.configuration) !== null && _b !== void 0 ? _b : false;
16798     }
16799     async initialized(params) {
16800         if (this.workspaceConfig) {
16801             if (params.register) {
16802                 // params.register(...) is a function to be provided by the calling language server for the sake of
16803                 //  decoupling this implementation from the concrete LSP implementations, specifically the LSP Connection
16804                 const languages = this.serviceRegistry.all;
16805                 params.register({
16806                     // Listen to configuration changes for all languages
16807                     section: languages.map(lang => this.toSectionName(lang.LanguageMetaData.languageId))
16808                 });
16809             }
16810             if (params.fetchConfiguration) {
16811                 // params.fetchConfiguration(...) is a function to be provided by the calling language server for the sake of
16812                 //  decoupling this implementation from the concrete LSP implementations, specifically the LSP Connection
16813                 const configToUpdate = this.serviceRegistry.all.map(lang => ({
16814                     // Fetch the configuration changes for all languages
16815                     section: this.toSectionName(lang.LanguageMetaData.languageId)
16816                 }));
16817                 // get workspace configurations (default scope URI)
16818                 const configs = await params.fetchConfiguration(configToUpdate);
16819                 configToUpdate.forEach((conf, idx) => {
16820                     this.updateSectionConfiguration(conf.section, configs[idx]);
16821                 });
16822             }
16823         }
16824         this._ready.resolve();
16825     }
16826     /**
16827      *  Updates the cached configurations using the `change` notification parameters.
16828      *
16829      * @param change The parameters of a change configuration notification.
16830      * `settings` property of the change object could be expressed as `Record<string, Record<string, any>>`
16831      */
16832     updateConfiguration(change) {
16833         if (!change.settings) {
16834             return;
16835         }
16836         Object.keys(change.settings).forEach(section => {
16837             const configuration = change.settings[section];
16838             this.updateSectionConfiguration(section, configuration);
16839             this.onConfigurationSectionUpdateEmitter.fire({ section, configuration });
16840         });
16841     }
16842     updateSectionConfiguration(section, configuration) {
16843         this.settings[section] = configuration;
16844     }
16845     /**
16846     * Returns a configuration value stored for the given language.
16847     *
16848     * @param language The language id
16849     * @param configuration Configuration name
16850     */
16851     async getConfiguration(language, configuration) {
16852         await this.ready;
16853         const sectionName = this.toSectionName(language);
16854         if (this.settings[sectionName]) {
16855             return this.settings[sectionName][configuration];
16856         }
16857     }
16858     toSectionName(languageId) {
16859         return `${languageId}`;
16860     }
16861     get onConfigurationSectionUpdate() {
16862         return this.onConfigurationSectionUpdateEmitter.event;
16863     }
16864 }
16865 //# sourceMappingURL=configuration.js.map
16866 ;// CONCATENATED MODULE: ../node_modules/langium/lib/utils/disposable.js
16867 /******************************************************************************
16868  * Copyright 2021 TypeFox GmbH
16869  * This program and the accompanying materials are made available under the
16870  * terms of the MIT License, which is available in the project root.
16871  ******************************************************************************/
16872 var Disposable;
16873 (function (Disposable) {
16874     function create(callback) {
16875         return {
16876             dispose: async () => await callback()
16877         };
16878     }
16879     Disposable.create = create;
16880 })(Disposable || (Disposable = {}));
16881 //# sourceMappingURL=disposable.js.map
16882 ;// CONCATENATED MODULE: ../node_modules/langium/lib/workspace/document-builder.js
16883 /******************************************************************************
16884  * Copyright 2021 TypeFox GmbH
16885  * This program and the accompanying materials are made available under the
16886  * terms of the MIT License, which is available in the project root.
16887  ******************************************************************************/
16888 
16889 
16890 
16891 
16892 
16893 
16894 
16895 class DefaultDocumentBuilder {
16896     constructor(services) {
16897         this.updateBuildOptions = {
16898             // Default: run only the built-in validation checks and those in the _fast_ category (includes those without category)
16899             validation: {
16900                 categories: ['built-in', 'fast']
16901             }
16902         };
16903         this.updateListeners = [];
16904         this.buildPhaseListeners = new MultiMap();
16905         this.documentPhaseListeners = new MultiMap();
16906         this.buildState = new Map();
16907         this.documentBuildWaiters = new Map();
16908         this.currentState = DocumentState.Changed;
16909         this.langiumDocuments = services.workspace.LangiumDocuments;
16910         this.langiumDocumentFactory = services.workspace.LangiumDocumentFactory;
16911         this.textDocuments = services.workspace.TextDocuments;
16912         this.indexManager = services.workspace.IndexManager;
16913         this.serviceRegistry = services.ServiceRegistry;
16914     }
16915     async build(documents, options = {}, cancelToken = cancellation.CancellationToken.None) {
16916         var _a, _b;
16917         for (const document of documents) {
16918             const key = document.uri.toString();
16919             if (document.state === DocumentState.Validated) {
16920                 if (typeof options.validation === 'boolean' && options.validation) {
16921                     // Force re-running all validation checks
16922                     document.state = DocumentState.IndexedReferences;
16923                     document.diagnostics = undefined;
16924                     this.buildState.delete(key);
16925                 }
16926                 else if (typeof options.validation === 'object') {
16927                     const buildState = this.buildState.get(key);
16928                     const previousCategories = (_a = buildState === null || buildState === void 0 ? void 0 : buildState.result) === null || _a === void 0 ? void 0 : _a.validationChecks;
16929                     if (previousCategories) {
16930                         // Validation with explicit options was requested for a document that has already been partly validated.
16931                         // In this case, we need to merge the previous validation categories with the new ones.
16932                         const newCategories = (_b = options.validation.categories) !== null && _b !== void 0 ? _b : ValidationCategory.all;
16933                         const categories = newCategories.filter(c => !previousCategories.includes(c));
16934                         if (categories.length > 0) {
16935                             this.buildState.set(key, {
16936                                 completed: false,
16937                                 options: {
16938                                     validation: Object.assign(Object.assign({}, options.validation), { categories })
16939                                 },
16940                                 result: buildState.result
16941                             });
16942                             document.state = DocumentState.IndexedReferences;
16943                         }
16944                     }
16945                 }
16946             }
16947             else {
16948                 // Default: forget any previous build options
16949                 this.buildState.delete(key);
16950             }
16951         }
16952         this.currentState = DocumentState.Changed;
16953         await this.emitUpdate(documents.map(e => e.uri), []);
16954         await this.buildDocuments(documents, options, cancelToken);
16955     }
16956     async update(changed, deleted, cancelToken = cancellation.CancellationToken.None) {
16957         this.currentState = DocumentState.Changed;
16958         // Remove all metadata of documents that are reported as deleted
16959         for (const deletedUri of deleted) {
16960             this.langiumDocuments.deleteDocument(deletedUri);
16961             this.buildState.delete(deletedUri.toString());
16962             this.indexManager.remove(deletedUri);
16963         }
16964         // Set the state of all changed documents to `Changed` so they are completely rebuilt
16965         for (const changedUri of changed) {
16966             const invalidated = this.langiumDocuments.invalidateDocument(changedUri);
16967             if (!invalidated) {
16968                 // We create an unparsed, invalid document.
16969                 // This will be parsed as soon as we reach the first document builder phase.
16970                 // This allows to cancel the parsing process later in case we need it.
16971                 const newDocument = this.langiumDocumentFactory.fromModel({ $type: 'INVALID' }, changedUri);
16972                 newDocument.state = DocumentState.Changed;
16973                 this.langiumDocuments.addDocument(newDocument);
16974             }
16975             this.buildState.delete(changedUri.toString());
16976         }
16977         // Set the state of all documents that should be relinked to `ComputedScopes` (if not already lower)
16978         const allChangedUris = (0,stream/* stream */.Vw)(changed).concat(deleted).map(uri => uri.toString()).toSet();
16979         this.langiumDocuments.all
16980             .filter(doc => !allChangedUris.has(doc.uri.toString()) && this.shouldRelink(doc, allChangedUris))
16981             .forEach(doc => {
16982             const linker = this.serviceRegistry.getServices(doc.uri).references.Linker;
16983             linker.unlink(doc);
16984             doc.state = Math.min(doc.state, DocumentState.ComputedScopes);
16985             doc.diagnostics = undefined;
16986         });
16987         // Notify listeners of the update
16988         await this.emitUpdate(changed, deleted);
16989         // Only allow interrupting the execution after all state changes are done
16990         await interruptAndCheck(cancelToken);
16991         // Collect and sort all documents that we should rebuild
16992         const rebuildDocuments = this.sortDocuments(this.langiumDocuments.all
16993             .filter(doc => {
16994             var _a;
16995             // This includes those that were reported as changed and those that we selected for relinking
16996             return doc.state < DocumentState.Linked
16997                 // This includes those for which a previous build has been cancelled
16998                 || !((_a = this.buildState.get(doc.uri.toString())) === null || _a === void 0 ? void 0 : _a.completed);
16999         })
17000             .toArray());
17001         await this.buildDocuments(rebuildDocuments, this.updateBuildOptions, cancelToken);
17002     }
17003     async emitUpdate(changed, deleted) {
17004         await Promise.all(this.updateListeners.map(listener => listener(changed, deleted)));
17005     }
17006     /**
17007      * Sort the given documents by priority. By default, documents with an open text document are prioritized.
17008      * This is useful to ensure that visible documents show their diagnostics before all other documents.
17009      *
17010      * This improves the responsiveness in large workspaces as users usually don't care about diagnostics
17011      * in files that are currently not opened in the editor.
17012      */
17013     sortDocuments(documents) {
17014         let left = 0;
17015         let right = documents.length - 1;
17016         while (left < right) {
17017             while (left < documents.length && this.hasTextDocument(documents[left])) {
17018                 left++;
17019             }
17020             while (right >= 0 && !this.hasTextDocument(documents[right])) {
17021                 right--;
17022             }
17023             if (left < right) {
17024                 [documents[left], documents[right]] = [documents[right], documents[left]];
17025             }
17026         }
17027         return documents;
17028     }
17029     hasTextDocument(doc) {
17030         var _a;
17031         return Boolean((_a = this.textDocuments) === null || _a === void 0 ? void 0 : _a.get(doc.uri));
17032     }
17033     /**
17034      * Check whether the given document should be relinked after changes were found in the given URIs.
17035      */
17036     shouldRelink(document, changedUris) {
17037         // Relink documents with linking errors -- maybe those references can be resolved now
17038         if (document.references.some(ref => ref.error !== undefined)) {
17039             return true;
17040         }
17041         // Check whether the document is affected by any of the changed URIs
17042         return this.indexManager.isAffected(document, changedUris);
17043     }
17044     onUpdate(callback) {
17045         this.updateListeners.push(callback);
17046         return Disposable.create(() => {
17047             const index = this.updateListeners.indexOf(callback);
17048             if (index >= 0) {
17049                 this.updateListeners.splice(index, 1);
17050             }
17051         });
17052     }
17053     /**
17054      * Build the given documents by stepping through all build phases. If a document's state indicates
17055      * that a certain build phase is already done, the phase is skipped for that document.
17056      *
17057      * @param documents The documents to build.
17058      * @param options the {@link BuildOptions} to use.
17059      * @param cancelToken A cancellation token that can be used to cancel the build.
17060      * @returns A promise that resolves when the build is done.
17061      */
17062     async buildDocuments(documents, options, cancelToken) {
17063         this.prepareBuild(documents, options);
17064         // 0. Parse content
17065         await this.runCancelable(documents, DocumentState.Parsed, cancelToken, doc => this.langiumDocumentFactory.update(doc, cancelToken));
17066         // 1. Index content
17067         await this.runCancelable(documents, DocumentState.IndexedContent, cancelToken, doc => this.indexManager.updateContent(doc, cancelToken));
17068         // 2. Compute scopes
17069         await this.runCancelable(documents, DocumentState.ComputedScopes, cancelToken, async (doc) => {
17070             const scopeComputation = this.serviceRegistry.getServices(doc.uri).references.ScopeComputation;
17071             doc.precomputedScopes = await scopeComputation.computeLocalScopes(doc, cancelToken);
17072         });
17073         // 3. Linking
17074         await this.runCancelable(documents, DocumentState.Linked, cancelToken, doc => {
17075             const linker = this.serviceRegistry.getServices(doc.uri).references.Linker;
17076             return linker.link(doc, cancelToken);
17077         });
17078         // 4. Index references
17079         await this.runCancelable(documents, DocumentState.IndexedReferences, cancelToken, doc => this.indexManager.updateReferences(doc, cancelToken));
17080         // 5. Validation
17081         const toBeValidated = documents.filter(doc => this.shouldValidate(doc));
17082         await this.runCancelable(toBeValidated, DocumentState.Validated, cancelToken, doc => this.validate(doc, cancelToken));
17083         // If we've made it to this point without being cancelled, we can mark the build state as completed.
17084         for (const doc of documents) {
17085             const state = this.buildState.get(doc.uri.toString());
17086             if (state) {
17087                 state.completed = true;
17088             }
17089         }
17090     }
17091     /**
17092      * Runs prior to beginning the build process to update the {@link DocumentBuildState} for each document
17093      *
17094      * @param documents collection of documents to be built
17095      * @param options the {@link BuildOptions} to use
17096      */
17097     prepareBuild(documents, options) {
17098         for (const doc of documents) {
17099             const key = doc.uri.toString();
17100             const state = this.buildState.get(key);
17101             // If the document has no previous build state, we set it. If it has one, but it's already marked
17102             // as completed, we overwrite it. If the previous build was not completed, we keep its state
17103             // and continue where it was cancelled.
17104             if (!state || state.completed) {
17105                 this.buildState.set(key, {
17106                     completed: false,
17107                     options,
17108                     result: state === null || state === void 0 ? void 0 : state.result
17109                 });
17110             }
17111         }
17112     }
17113     /**
17114      * Runs a cancelable operation on a set of documents to bring them to a specified {@link DocumentState}.
17115      *
17116      * @param documents The array of documents to process.
17117      * @param targetState The target {@link DocumentState} to bring the documents to.
17118      * @param cancelToken A token that can be used to cancel the operation.
17119      * @param callback A function to be called for each document.
17120      * @returns A promise that resolves when all documents have been processed or the operation is canceled.
17121      * @throws Will throw `OperationCancelled` if the operation is canceled via a `CancellationToken`.
17122      */
17123     async runCancelable(documents, targetState, cancelToken, callback) {
17124         const filtered = documents.filter(doc => doc.state < targetState);
17125         for (const document of filtered) {
17126             await interruptAndCheck(cancelToken);
17127             await callback(document);
17128             document.state = targetState;
17129             await this.notifyDocumentPhase(document, targetState, cancelToken);
17130         }
17131         // Do not use `filtered` here, as that will miss documents that have previously reached the current target state
17132         // For example, this happens in case the cancellation triggers between the processing of two documents
17133         // Or files that were picked up during the workspace initialization
17134         const targetStateDocs = documents.filter(doc => doc.state === targetState);
17135         await this.notifyBuildPhase(targetStateDocs, targetState, cancelToken);
17136         this.currentState = targetState;
17137     }
17138     onBuildPhase(targetState, callback) {
17139         this.buildPhaseListeners.add(targetState, callback);
17140         return Disposable.create(() => {
17141             this.buildPhaseListeners.delete(targetState, callback);
17142         });
17143     }
17144     onDocumentPhase(targetState, callback) {
17145         this.documentPhaseListeners.add(targetState, callback);
17146         return Disposable.create(() => {
17147             this.documentPhaseListeners.delete(targetState, callback);
17148         });
17149     }
17150     waitUntil(state, uriOrToken, cancelToken) {
17151         let uri = undefined;
17152         if (uriOrToken && 'path' in uriOrToken) {
17153             uri = uriOrToken;
17154         }
17155         else {
17156             cancelToken = uriOrToken;
17157         }
17158         cancelToken !== null && cancelToken !== void 0 ? cancelToken : (cancelToken = cancellation.CancellationToken.None);
17159         if (uri) {
17160             const document = this.langiumDocuments.getDocument(uri);
17161             if (document && document.state > state) {
17162                 return Promise.resolve(uri);
17163             }
17164         }
17165         if (this.currentState >= state) {
17166             return Promise.resolve(undefined);
17167         }
17168         else if (cancelToken.isCancellationRequested) {
17169             return Promise.reject(promise_utils_OperationCancelled);
17170         }
17171         return new Promise((resolve, reject) => {
17172             const buildDisposable = this.onBuildPhase(state, () => {
17173                 buildDisposable.dispose();
17174                 cancelDisposable.dispose();
17175                 if (uri) {
17176                     const document = this.langiumDocuments.getDocument(uri);
17177                     resolve(document === null || document === void 0 ? void 0 : document.uri);
17178                 }
17179                 else {
17180                     resolve(undefined);
17181                 }
17182             });
17183             const cancelDisposable = cancelToken.onCancellationRequested(() => {
17184                 buildDisposable.dispose();
17185                 cancelDisposable.dispose();
17186                 reject(promise_utils_OperationCancelled);
17187             });
17188         });
17189     }
17190     async notifyDocumentPhase(document, state, cancelToken) {
17191         const listeners = this.documentPhaseListeners.get(state);
17192         const listenersCopy = listeners.slice();
17193         for (const listener of listenersCopy) {
17194             try {
17195                 await listener(document, cancelToken);
17196             }
17197             catch (err) {
17198                 // Ignore cancellation errors
17199                 // We want to finish the listeners before throwing
17200                 if (!isOperationCancelled(err)) {
17201                     throw err;
17202                 }
17203             }
17204         }
17205     }
17206     async notifyBuildPhase(documents, state, cancelToken) {
17207         if (documents.length === 0) {
17208             // Don't notify when no document has been processed
17209             return;
17210         }
17211         const listeners = this.buildPhaseListeners.get(state);
17212         const listenersCopy = listeners.slice();
17213         for (const listener of listenersCopy) {
17214             await interruptAndCheck(cancelToken);
17215             await listener(documents, cancelToken);
17216         }
17217     }
17218     /**
17219      * Determine whether the given document should be validated during a build. The default
17220      * implementation checks the `validation` property of the build options. If it's set to `true`
17221      * or a `ValidationOptions` object, the document is included in the validation phase.
17222      */
17223     shouldValidate(document) {
17224         return Boolean(this.getBuildOptions(document).validation);
17225     }
17226     /**
17227      * Run validation checks on the given document and store the resulting diagnostics in the document.
17228      * If the document already contains diagnostics, the new ones are added to the list.
17229      */
17230     async validate(document, cancelToken) {
17231         var _a, _b;
17232         const validator = this.serviceRegistry.getServices(document.uri).validation.DocumentValidator;
17233         const validationSetting = this.getBuildOptions(document).validation;
17234         const options = typeof validationSetting === 'object' ? validationSetting : undefined;
17235         const diagnostics = await validator.validateDocument(document, options, cancelToken);
17236         if (document.diagnostics) {
17237             document.diagnostics.push(...diagnostics);
17238         }
17239         else {
17240             document.diagnostics = diagnostics;
17241         }
17242         // Store information about the executed validation in the build state
17243         const state = this.buildState.get(document.uri.toString());
17244         if (state) {
17245             (_a = state.result) !== null && _a !== void 0 ? _a : (state.result = {});
17246             const newCategories = (_b = options === null || options === void 0 ? void 0 : options.categories) !== null && _b !== void 0 ? _b : ValidationCategory.all;
17247             if (state.result.validationChecks) {
17248                 state.result.validationChecks.push(...newCategories);
17249             }
17250             else {
17251                 state.result.validationChecks = [...newCategories];
17252             }
17253         }
17254     }
17255     getBuildOptions(document) {
17256         var _a, _b;
17257         return (_b = (_a = this.buildState.get(document.uri.toString())) === null || _a === void 0 ? void 0 : _a.options) !== null && _b !== void 0 ? _b : {};
17258     }
17259 }
17260 //# sourceMappingURL=document-builder.js.map
17261 ;// CONCATENATED MODULE: ../node_modules/langium/lib/workspace/index-manager.js
17262 /******************************************************************************
17263  * Copyright 2021 TypeFox GmbH
17264  * This program and the accompanying materials are made available under the
17265  * terms of the MIT License, which is available in the project root.
17266  ******************************************************************************/
17267 
17268 
17269 
17270 
17271 
17272 class DefaultIndexManager {
17273     constructor(services) {
17274         /**
17275          * The symbol index stores all `AstNodeDescription` items exported by a document.
17276          * The key used in this map is the string representation of the specific document URI.
17277          */
17278         this.symbolIndex = new Map();
17279         /**
17280          * This is a cache for the `allElements()` method.
17281          * It caches the descriptions from `symbolIndex` grouped by types.
17282          */
17283         this.symbolByTypeIndex = new ContextCache();
17284         /**
17285          * This index keeps track of all `ReferenceDescription` items exported by a document.
17286          * This is used to compute which elements are affected by a document change
17287          * and for finding references to an AST node.
17288          */
17289         this.referenceIndex = new Map();
17290         this.documents = services.workspace.LangiumDocuments;
17291         this.serviceRegistry = services.ServiceRegistry;
17292         this.astReflection = services.AstReflection;
17293     }
17294     findAllReferences(targetNode, astNodePath) {
17295         const targetDocUri = (0,ast_utils/* getDocument */.Me)(targetNode).uri;
17296         const result = [];
17297         this.referenceIndex.forEach(docRefs => {
17298             docRefs.forEach(refDescr => {
17299                 if (UriUtils.equals(refDescr.targetUri, targetDocUri) && refDescr.targetPath === astNodePath) {
17300                     result.push(refDescr);
17301                 }
17302             });
17303         });
17304         return (0,stream/* stream */.Vw)(result);
17305     }
17306     allElements(nodeType, uris) {
17307         let documentUris = (0,stream/* stream */.Vw)(this.symbolIndex.keys());
17308         if (uris) {
17309             documentUris = documentUris.filter(uri => !uris || uris.has(uri));
17310         }
17311         return documentUris
17312             .map(uri => this.getFileDescriptions(uri, nodeType))
17313             .flat();
17314     }
17315     getFileDescriptions(uri, nodeType) {
17316         var _a;
17317         if (!nodeType) {
17318             return (_a = this.symbolIndex.get(uri)) !== null && _a !== void 0 ? _a : [];
17319         }
17320         const descriptions = this.symbolByTypeIndex.get(uri, nodeType, () => {
17321             var _a;
17322             const allFileDescriptions = (_a = this.symbolIndex.get(uri)) !== null && _a !== void 0 ? _a : [];
17323             return allFileDescriptions.filter(e => this.astReflection.isSubtype(e.type, nodeType));
17324         });
17325         return descriptions;
17326     }
17327     remove(uri) {
17328         const uriString = uri.toString();
17329         this.symbolIndex.delete(uriString);
17330         this.symbolByTypeIndex.clear(uriString);
17331         this.referenceIndex.delete(uriString);
17332     }
17333     async updateContent(document, cancelToken = cancellation.CancellationToken.None) {
17334         const services = this.serviceRegistry.getServices(document.uri);
17335         const exports = await services.references.ScopeComputation.computeExports(document, cancelToken);
17336         const uri = document.uri.toString();
17337         this.symbolIndex.set(uri, exports);
17338         this.symbolByTypeIndex.clear(uri);
17339     }
17340     async updateReferences(document, cancelToken = cancellation.CancellationToken.None) {
17341         const services = this.serviceRegistry.getServices(document.uri);
17342         const indexData = await services.workspace.ReferenceDescriptionProvider.createDescriptions(document, cancelToken);
17343         this.referenceIndex.set(document.uri.toString(), indexData);
17344     }
17345     isAffected(document, changedUris) {
17346         const references = this.referenceIndex.get(document.uri.toString());
17347         if (!references) {
17348             return false;
17349         }
17350         return references.some(ref => !ref.local && changedUris.has(ref.targetUri.toString()));
17351     }
17352 }
17353 //# sourceMappingURL=index-manager.js.map
17354 ;// CONCATENATED MODULE: ../node_modules/langium/lib/workspace/workspace-manager.js
17355 /******************************************************************************
17356  * Copyright 2022 TypeFox GmbH
17357  * This program and the accompanying materials are made available under the
17358  * terms of the MIT License, which is available in the project root.
17359  ******************************************************************************/
17360 
17361 
17362 
17363 class DefaultWorkspaceManager {
17364     constructor(services) {
17365         this.initialBuildOptions = {};
17366         this._ready = new promise_utils_Deferred();
17367         this.serviceRegistry = services.ServiceRegistry;
17368         this.langiumDocuments = services.workspace.LangiumDocuments;
17369         this.documentBuilder = services.workspace.DocumentBuilder;
17370         this.fileSystemProvider = services.workspace.FileSystemProvider;
17371         this.mutex = services.workspace.WorkspaceLock;
17372     }
17373     get ready() {
17374         return this._ready.promise;
17375     }
17376     get workspaceFolders() {
17377         return this.folders;
17378     }
17379     initialize(params) {
17380         var _a;
17381         this.folders = (_a = params.workspaceFolders) !== null && _a !== void 0 ? _a : undefined;
17382     }
17383     initialized(_params) {
17384         // Initialize the workspace even if there are no workspace folders
17385         // We still want to load additional documents (language library or similar) during initialization
17386         return this.mutex.write(token => { var _a; return this.initializeWorkspace((_a = this.folders) !== null && _a !== void 0 ? _a : [], token); });
17387     }
17388     async initializeWorkspace(folders, cancelToken = cancellation.CancellationToken.None) {
17389         const documents = await this.performStartup(folders);
17390         // Only after creating all documents do we check whether we need to cancel the initialization
17391         // The document builder will later pick up on all unprocessed documents
17392         await interruptAndCheck(cancelToken);
17393         await this.documentBuilder.build(documents, this.initialBuildOptions, cancelToken);
17394     }
17395     /**
17396      * Performs the uninterruptable startup sequence of the workspace manager.
17397      * This methods loads all documents in the workspace and other documents and returns them.
17398      */
17399     async performStartup(folders) {
17400         const fileExtensions = this.serviceRegistry.all.flatMap(e => e.LanguageMetaData.fileExtensions);
17401         const documents = [];
17402         const collector = (document) => {
17403             documents.push(document);
17404             if (!this.langiumDocuments.hasDocument(document.uri)) {
17405                 this.langiumDocuments.addDocument(document);
17406             }
17407         };
17408         // Even though we don't await the initialization of the workspace manager,
17409         // we can still assume that all library documents and file documents are loaded by the time we start building documents.
17410         // The mutex prevents anything from performing a workspace build until we check the cancellation token
17411         await this.loadAdditionalDocuments(folders, collector);
17412         await Promise.all(folders.map(wf => [wf, this.getRootFolder(wf)])
17413             .map(async (entry) => this.traverseFolder(...entry, fileExtensions, collector)));
17414         this._ready.resolve();
17415         return documents;
17416     }
17417     /**
17418      * Load all additional documents that shall be visible in the context of the given workspace
17419      * folders and add them to the collector. This can be used to include built-in libraries of
17420      * your language, which can be either loaded from provided files or constructed in memory.
17421      */
17422     loadAdditionalDocuments(_folders, _collector) {
17423         return Promise.resolve();
17424     }
17425     /**
17426      * Determine the root folder of the source documents in the given workspace folder.
17427      * The default implementation returns the URI of the workspace folder, but you can override
17428      * this to return a subfolder like `src` instead.
17429      */
17430     getRootFolder(workspaceFolder) {
17431         return esm/* URI */.o.parse(workspaceFolder.uri);
17432     }
17433     /**
17434      * Traverse the file system folder identified by the given URI and its subfolders. All
17435      * contained files that match the file extensions are added to the collector.
17436      */
17437     async traverseFolder(workspaceFolder, folderPath, fileExtensions, collector) {
17438         const content = await this.fileSystemProvider.readDirectory(folderPath);
17439         await Promise.all(content.map(async (entry) => {
17440             if (this.includeEntry(workspaceFolder, entry, fileExtensions)) {
17441                 if (entry.isDirectory) {
17442                     await this.traverseFolder(workspaceFolder, entry.uri, fileExtensions, collector);
17443                 }
17444                 else if (entry.isFile) {
17445                     const document = await this.langiumDocuments.getOrCreateDocument(entry.uri);
17446                     collector(document);
17447                 }
17448             }
17449         }));
17450     }
17451     /**
17452      * Determine whether the given folder entry shall be included while indexing the workspace.
17453      */
17454     includeEntry(_workspaceFolder, entry, fileExtensions) {
17455         const name = UriUtils.basename(entry.uri);
17456         if (name.startsWith('.')) {
17457             return false;
17458         }
17459         if (entry.isDirectory) {
17460             return name !== 'node_modules' && name !== 'out';
17461         }
17462         else if (entry.isFile) {
17463             const extname = UriUtils.extname(entry.uri);
17464             return fileExtensions.includes(extname);
17465         }
17466         return false;
17467     }
17468 }
17469 //# sourceMappingURL=workspace-manager.js.map
17470 ;// CONCATENATED MODULE: ../node_modules/langium/lib/parser/lexer.js
17471 /******************************************************************************
17472  * Copyright 2022 TypeFox GmbH
17473  * This program and the accompanying materials are made available under the
17474  * terms of the MIT License, which is available in the project root.
17475  ******************************************************************************/
17476 
17477 class DefaultLexerErrorMessageProvider {
17478     buildUnexpectedCharactersMessage(fullText, startOffset, length, line, column) {
17479         return api/* defaultLexerErrorProvider */.ZW.buildUnexpectedCharactersMessage(fullText, startOffset, length, line, column);
17480     }
17481     buildUnableToPopLexerModeMessage(token) {
17482         return api/* defaultLexerErrorProvider */.ZW.buildUnableToPopLexerModeMessage(token);
17483     }
17484 }
17485 const DEFAULT_TOKENIZE_OPTIONS = { mode: 'full' };
17486 class DefaultLexer {
17487     constructor(services) {
17488         this.errorMessageProvider = services.parser.LexerErrorMessageProvider;
17489         this.tokenBuilder = services.parser.TokenBuilder;
17490         const tokens = this.tokenBuilder.buildTokens(services.Grammar, {
17491             caseInsensitive: services.LanguageMetaData.caseInsensitive
17492         });
17493         this.tokenTypes = this.toTokenTypeDictionary(tokens);
17494         const lexerTokens = isTokenTypeDictionary(tokens) ? Object.values(tokens) : tokens;
17495         const production = services.LanguageMetaData.mode === 'production';
17496         this.chevrotainLexer = new api/* Lexer */.hW(lexerTokens, {
17497             positionTracking: 'full',
17498             skipValidations: production,
17499             errorMessageProvider: this.errorMessageProvider
17500         });
17501     }
17502     get definition() {
17503         return this.tokenTypes;
17504     }
17505     tokenize(text, _options = DEFAULT_TOKENIZE_OPTIONS) {
17506         var _a, _b, _c;
17507         const chevrotainResult = this.chevrotainLexer.tokenize(text);
17508         return {
17509             tokens: chevrotainResult.tokens,
17510             errors: chevrotainResult.errors,
17511             hidden: (_a = chevrotainResult.groups.hidden) !== null && _a !== void 0 ? _a : [],
17512             report: (_c = (_b = this.tokenBuilder).flushLexingReport) === null || _c === void 0 ? void 0 : _c.call(_b, text)
17513         };
17514     }
17515     toTokenTypeDictionary(buildTokens) {
17516         if (isTokenTypeDictionary(buildTokens))
17517             return buildTokens;
17518         const tokens = isIMultiModeLexerDefinition(buildTokens) ? Object.values(buildTokens.modes).flat() : buildTokens;
17519         const res = {};
17520         tokens.forEach(token => res[token.name] = token);
17521         return res;
17522     }
17523 }
17524 /**
17525  * Returns a check whether the given TokenVocabulary is TokenType array
17526  */
17527 function isTokenTypeArray(tokenVocabulary) {
17528     return Array.isArray(tokenVocabulary) && (tokenVocabulary.length === 0 || 'name' in tokenVocabulary[0]);
17529 }
17530 /**
17531  * Returns a check whether the given TokenVocabulary is IMultiModeLexerDefinition
17532  */
17533 function isIMultiModeLexerDefinition(tokenVocabulary) {
17534     return tokenVocabulary && 'modes' in tokenVocabulary && 'defaultMode' in tokenVocabulary;
17535 }
17536 /**
17537  * Returns a check whether the given TokenVocabulary is TokenTypeDictionary
17538  */
17539 function isTokenTypeDictionary(tokenVocabulary) {
17540     return !isTokenTypeArray(tokenVocabulary) && !isIMultiModeLexerDefinition(tokenVocabulary);
17541 }
17542 //# sourceMappingURL=lexer.js.map
17543 ;// CONCATENATED MODULE: ../node_modules/langium/lib/documentation/jsdoc.js
17544 /******************************************************************************
17545  * Copyright 2023 TypeFox GmbH
17546  * This program and the accompanying materials are made available under the
17547  * terms of the MIT License, which is available in the project root.
17548  ******************************************************************************/
17549 
17550 
17551 
17552 function parseJSDoc(node, start, options) {
17553     let opts;
17554     let position;
17555     if (typeof node === 'string') {
17556         position = start;
17557         opts = options;
17558     }
17559     else {
17560         position = node.range.start;
17561         opts = start;
17562     }
17563     if (!position) {
17564         position = Position.create(0, 0);
17565     }
17566     const lines = getLines(node);
17567     const normalizedOptions = normalizeOptions(opts);
17568     const tokens = tokenize({
17569         lines,
17570         position,
17571         options: normalizedOptions
17572     });
17573     return parseJSDocComment({
17574         index: 0,
17575         tokens,
17576         position
17577     });
17578 }
17579 function isJSDoc(node, options) {
17580     const normalizedOptions = normalizeOptions(options);
17581     const lines = getLines(node);
17582     if (lines.length === 0) {
17583         return false;
17584     }
17585     const first = lines[0];
17586     const last = lines[lines.length - 1];
17587     const firstRegex = normalizedOptions.start;
17588     const lastRegex = normalizedOptions.end;
17589     return Boolean(firstRegex === null || firstRegex === void 0 ? void 0 : firstRegex.exec(first)) && Boolean(lastRegex === null || lastRegex === void 0 ? void 0 : lastRegex.exec(last));
17590 }
17591 function getLines(node) {
17592     let content = '';
17593     if (typeof node === 'string') {
17594         content = node;
17595     }
17596     else {
17597         content = node.text;
17598     }
17599     const lines = content.split(regexp_utils/* NEWLINE_REGEXP */.K0);
17600     return lines;
17601 }
17602 const tagRegex = /\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy;
17603 const inlineTagRegex = /\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;
17604 function tokenize(context) {
17605     var _a, _b, _c;
17606     const tokens = [];
17607     let currentLine = context.position.line;
17608     let currentCharacter = context.position.character;
17609     for (let i = 0; i < context.lines.length; i++) {
17610         const first = i === 0;
17611         const last = i === context.lines.length - 1;
17612         let line = context.lines[i];
17613         let index = 0;
17614         if (first && context.options.start) {
17615             const match = (_a = context.options.start) === null || _a === void 0 ? void 0 : _a.exec(line);
17616             if (match) {
17617                 index = match.index + match[0].length;
17618             }
17619         }
17620         else {
17621             const match = (_b = context.options.line) === null || _b === void 0 ? void 0 : _b.exec(line);
17622             if (match) {
17623                 index = match.index + match[0].length;
17624             }
17625         }
17626         if (last) {
17627             const match = (_c = context.options.end) === null || _c === void 0 ? void 0 : _c.exec(line);
17628             if (match) {
17629                 line = line.substring(0, match.index);
17630             }
17631         }
17632         line = line.substring(0, lastCharacter(line));
17633         const whitespaceEnd = skipWhitespace(line, index);
17634         if (whitespaceEnd >= line.length) {
17635             // Only create a break token when we already have previous tokens
17636             if (tokens.length > 0) {
17637                 const position = Position.create(currentLine, currentCharacter);
17638                 tokens.push({
17639                     type: 'break',
17640                     content: '',
17641                     range: Range.create(position, position)
17642                 });
17643             }
17644         }
17645         else {
17646             tagRegex.lastIndex = index;
17647             const tagMatch = tagRegex.exec(line);
17648             if (tagMatch) {
17649                 const fullMatch = tagMatch[0];
17650                 const value = tagMatch[1];
17651                 const start = Position.create(currentLine, currentCharacter + index);
17652                 const end = Position.create(currentLine, currentCharacter + index + fullMatch.length);
17653                 tokens.push({
17654                     type: 'tag',
17655                     content: value,
17656                     range: Range.create(start, end)
17657                 });
17658                 index += fullMatch.length;
17659                 index = skipWhitespace(line, index);
17660             }
17661             if (index < line.length) {
17662                 const rest = line.substring(index);
17663                 const inlineTagMatches = Array.from(rest.matchAll(inlineTagRegex));
17664                 tokens.push(...buildInlineTokens(inlineTagMatches, rest, currentLine, currentCharacter + index));
17665             }
17666         }
17667         currentLine++;
17668         currentCharacter = 0;
17669     }
17670     // Remove last break token if there is one
17671     if (tokens.length > 0 && tokens[tokens.length - 1].type === 'break') {
17672         return tokens.slice(0, -1);
17673     }
17674     return tokens;
17675 }
17676 function buildInlineTokens(tags, line, lineIndex, characterIndex) {
17677     const tokens = [];
17678     if (tags.length === 0) {
17679         const start = Position.create(lineIndex, characterIndex);
17680         const end = Position.create(lineIndex, characterIndex + line.length);
17681         tokens.push({
17682             type: 'text',
17683             content: line,
17684             range: Range.create(start, end)
17685         });
17686     }
17687     else {
17688         let lastIndex = 0;
17689         for (const match of tags) {
17690             const matchIndex = match.index;
17691             const startContent = line.substring(lastIndex, matchIndex);
17692             if (startContent.length > 0) {
17693                 tokens.push({
17694                     type: 'text',
17695                     content: line.substring(lastIndex, matchIndex),
17696                     range: Range.create(Position.create(lineIndex, lastIndex + characterIndex), Position.create(lineIndex, matchIndex + characterIndex))
17697                 });
17698             }
17699             let offset = startContent.length + 1;
17700             const tagName = match[1];
17701             tokens.push({
17702                 type: 'inline-tag',
17703                 content: tagName,
17704                 range: Range.create(Position.create(lineIndex, lastIndex + offset + characterIndex), Position.create(lineIndex, lastIndex + offset + tagName.length + characterIndex))
17705             });
17706             offset += tagName.length;
17707             if (match.length === 4) {
17708                 offset += match[2].length;
17709                 const value = match[3];
17710                 tokens.push({
17711                     type: 'text',
17712                     content: value,
17713                     range: Range.create(Position.create(lineIndex, lastIndex + offset + characterIndex), Position.create(lineIndex, lastIndex + offset + value.length + characterIndex))
17714                 });
17715             }
17716             else {
17717                 tokens.push({
17718                     type: 'text',
17719                     content: '',
17720                     range: Range.create(Position.create(lineIndex, lastIndex + offset + characterIndex), Position.create(lineIndex, lastIndex + offset + characterIndex))
17721                 });
17722             }
17723             lastIndex = matchIndex + match[0].length;
17724         }
17725         const endContent = line.substring(lastIndex);
17726         if (endContent.length > 0) {
17727             tokens.push({
17728                 type: 'text',
17729                 content: endContent,
17730                 range: Range.create(Position.create(lineIndex, lastIndex + characterIndex), Position.create(lineIndex, lastIndex + characterIndex + endContent.length))
17731             });
17732         }
17733     }
17734     return tokens;
17735 }
17736 const nonWhitespaceRegex = /\S/;
17737 const whitespaceEndRegex = /\s*$/;
17738 function skipWhitespace(line, index) {
17739     const match = line.substring(index).match(nonWhitespaceRegex);
17740     if (match) {
17741         return index + match.index;
17742     }
17743     else {
17744         return line.length;
17745     }
17746 }
17747 function lastCharacter(line) {
17748     const match = line.match(whitespaceEndRegex);
17749     if (match && typeof match.index === 'number') {
17750         return match.index;
17751     }
17752     return undefined;
17753 }
17754 // Parsing
17755 function parseJSDocComment(context) {
17756     var _a, _b, _c, _d;
17757     const startPosition = Position.create(context.position.line, context.position.character);
17758     if (context.tokens.length === 0) {
17759         return new JSDocCommentImpl([], Range.create(startPosition, startPosition));
17760     }
17761     const elements = [];
17762     while (context.index < context.tokens.length) {
17763         const element = parseJSDocElement(context, elements[elements.length - 1]);
17764         if (element) {
17765             elements.push(element);
17766         }
17767     }
17768     const start = (_b = (_a = elements[0]) === null || _a === void 0 ? void 0 : _a.range.start) !== null && _b !== void 0 ? _b : startPosition;
17769     const end = (_d = (_c = elements[elements.length - 1]) === null || _c === void 0 ? void 0 : _c.range.end) !== null && _d !== void 0 ? _d : startPosition;
17770     return new JSDocCommentImpl(elements, Range.create(start, end));
17771 }
17772 function parseJSDocElement(context, last) {
17773     const next = context.tokens[context.index];
17774     if (next.type === 'tag') {
17775         return parseJSDocTag(context, false);
17776     }
17777     else if (next.type === 'text' || next.type === 'inline-tag') {
17778         return parseJSDocText(context);
17779     }
17780     else {
17781         appendEmptyLine(next, last);
17782         context.index++;
17783         return undefined;
17784     }
17785 }
17786 function appendEmptyLine(token, element) {
17787     if (element) {
17788         const line = new JSDocLineImpl('', token.range);
17789         if ('inlines' in element) {
17790             element.inlines.push(line);
17791         }
17792         else {
17793             element.content.inlines.push(line);
17794         }
17795     }
17796 }
17797 function parseJSDocText(context) {
17798     let token = context.tokens[context.index];
17799     const firstToken = token;
17800     let lastToken = token;
17801     const lines = [];
17802     while (token && token.type !== 'break' && token.type !== 'tag') {
17803         lines.push(parseJSDocInline(context));
17804         lastToken = token;
17805         token = context.tokens[context.index];
17806     }
17807     return new JSDocTextImpl(lines, Range.create(firstToken.range.start, lastToken.range.end));
17808 }
17809 function parseJSDocInline(context) {
17810     const token = context.tokens[context.index];
17811     if (token.type === 'inline-tag') {
17812         return parseJSDocTag(context, true);
17813     }
17814     else {
17815         return parseJSDocLine(context);
17816     }
17817 }
17818 function parseJSDocTag(context, inline) {
17819     const tagToken = context.tokens[context.index++];
17820     const name = tagToken.content.substring(1);
17821     const nextToken = context.tokens[context.index];
17822     if ((nextToken === null || nextToken === void 0 ? void 0 : nextToken.type) === 'text') {
17823         if (inline) {
17824             const docLine = parseJSDocLine(context);
17825             return new JSDocTagImpl(name, new JSDocTextImpl([docLine], docLine.range), inline, Range.create(tagToken.range.start, docLine.range.end));
17826         }
17827         else {
17828             const textDoc = parseJSDocText(context);
17829             return new JSDocTagImpl(name, textDoc, inline, Range.create(tagToken.range.start, textDoc.range.end));
17830         }
17831     }
17832     else {
17833         const range = tagToken.range;
17834         return new JSDocTagImpl(name, new JSDocTextImpl([], range), inline, range);
17835     }
17836 }
17837 function parseJSDocLine(context) {
17838     const token = context.tokens[context.index++];
17839     return new JSDocLineImpl(token.content, token.range);
17840 }
17841 function normalizeOptions(options) {
17842     if (!options) {
17843         return normalizeOptions({
17844             start: '/**',
17845             end: '*/',
17846             line: '*'
17847         });
17848     }
17849     const { start, end, line } = options;
17850     return {
17851         start: normalizeOption(start, true),
17852         end: normalizeOption(end, false),
17853         line: normalizeOption(line, true)
17854     };
17855 }
17856 function normalizeOption(option, start) {
17857     if (typeof option === 'string' || typeof option === 'object') {
17858         const escaped = typeof option === 'string' ? (0,regexp_utils/* escapeRegExp */.hr)(option) : option.source;
17859         if (start) {
17860             return new RegExp(`^\\s*${escaped}`);
17861         }
17862         else {
17863             return new RegExp(`\\s*${escaped}\\s*$`);
17864         }
17865     }
17866     else {
17867         return option;
17868     }
17869 }
17870 class JSDocCommentImpl {
17871     constructor(elements, range) {
17872         this.elements = elements;
17873         this.range = range;
17874     }
17875     getTag(name) {
17876         return this.getAllTags().find(e => e.name === name);
17877     }
17878     getTags(name) {
17879         return this.getAllTags().filter(e => e.name === name);
17880     }
17881     getAllTags() {
17882         return this.elements.filter((e) => 'name' in e);
17883     }
17884     toString() {
17885         let value = '';
17886         for (const element of this.elements) {
17887             if (value.length === 0) {
17888                 value = element.toString();
17889             }
17890             else {
17891                 const text = element.toString();
17892                 value += fillNewlines(value) + text;
17893             }
17894         }
17895         return value.trim();
17896     }
17897     toMarkdown(options) {
17898         let value = '';
17899         for (const element of this.elements) {
17900             if (value.length === 0) {
17901                 value = element.toMarkdown(options);
17902             }
17903             else {
17904                 const text = element.toMarkdown(options);
17905                 value += fillNewlines(value) + text;
17906             }
17907         }
17908         return value.trim();
17909     }
17910 }
17911 class JSDocTagImpl {
17912     constructor(name, content, inline, range) {
17913         this.name = name;
17914         this.content = content;
17915         this.inline = inline;
17916         this.range = range;
17917     }
17918     toString() {
17919         let text = `@${this.name}`;
17920         const content = this.content.toString();
17921         if (this.content.inlines.length === 1) {
17922             text = `${text} ${content}`;
17923         }
17924         else if (this.content.inlines.length > 1) {
17925             text = `${text}\n${content}`;
17926         }
17927         if (this.inline) {
17928             // Inline tags are surrounded by curly braces
17929             return `{${text}}`;
17930         }
17931         else {
17932             return text;
17933         }
17934     }
17935     toMarkdown(options) {
17936         var _a, _b;
17937         return (_b = (_a = options === null || options === void 0 ? void 0 : options.renderTag) === null || _a === void 0 ? void 0 : _a.call(options, this)) !== null && _b !== void 0 ? _b : this.toMarkdownDefault(options);
17938     }
17939     toMarkdownDefault(options) {
17940         const content = this.content.toMarkdown(options);
17941         if (this.inline) {
17942             const rendered = renderInlineTag(this.name, content, options !== null && options !== void 0 ? options : {});
17943             if (typeof rendered === 'string') {
17944                 return rendered;
17945             }
17946         }
17947         let marker = '';
17948         if ((options === null || options === void 0 ? void 0 : options.tag) === 'italic' || (options === null || options === void 0 ? void 0 : options.tag) === undefined) {
17949             marker = '*';
17950         }
17951         else if ((options === null || options === void 0 ? void 0 : options.tag) === 'bold') {
17952             marker = '**';
17953         }
17954         else if ((options === null || options === void 0 ? void 0 : options.tag) === 'bold-italic') {
17955             marker = '***';
17956         }
17957         let text = `${marker}@${this.name}${marker}`;
17958         if (this.content.inlines.length === 1) {
17959             text = `${text} — ${content}`;
17960         }
17961         else if (this.content.inlines.length > 1) {
17962             text = `${text}\n${content}`;
17963         }
17964         if (this.inline) {
17965             // Inline tags are surrounded by curly braces
17966             return `{${text}}`;
17967         }
17968         else {
17969             return text;
17970         }
17971     }
17972 }
17973 function renderInlineTag(tag, content, options) {
17974     var _a, _b;
17975     if (tag === 'linkplain' || tag === 'linkcode' || tag === 'link') {
17976         const index = content.indexOf(' ');
17977         let display = content;
17978         if (index > 0) {
17979             const displayStart = skipWhitespace(content, index);
17980             display = content.substring(displayStart);
17981             content = content.substring(0, index);
17982         }
17983         if (tag === 'linkcode' || (tag === 'link' && options.link === 'code')) {
17984             // Surround the display value in a markdown inline code block
17985             display = `\`${display}\``;
17986         }
17987         const renderedLink = (_b = (_a = options.renderLink) === null || _a === void 0 ? void 0 : _a.call(options, content, display)) !== null && _b !== void 0 ? _b : renderLinkDefault(content, display);
17988         return renderedLink;
17989     }
17990     return undefined;
17991 }
17992 function renderLinkDefault(content, display) {
17993     try {
17994         esm/* URI */.o.parse(content, true);
17995         return `[${display}](${content})`;
17996     }
17997     catch (_a) {
17998         return content;
17999     }
18000 }
18001 class JSDocTextImpl {
18002     constructor(lines, range) {
18003         this.inlines = lines;
18004         this.range = range;
18005     }
18006     toString() {
18007         let text = '';
18008         for (let i = 0; i < this.inlines.length; i++) {
18009             const inline = this.inlines[i];
18010             const next = this.inlines[i + 1];
18011             text += inline.toString();
18012             if (next && next.range.start.line > inline.range.start.line) {
18013                 text += '\n';
18014             }
18015         }
18016         return text;
18017     }
18018     toMarkdown(options) {
18019         let text = '';
18020         for (let i = 0; i < this.inlines.length; i++) {
18021             const inline = this.inlines[i];
18022             const next = this.inlines[i + 1];
18023             text += inline.toMarkdown(options);
18024             if (next && next.range.start.line > inline.range.start.line) {
18025                 text += '\n';
18026             }
18027         }
18028         return text;
18029     }
18030 }
18031 class JSDocLineImpl {
18032     constructor(text, range) {
18033         this.text = text;
18034         this.range = range;
18035     }
18036     toString() {
18037         return this.text;
18038     }
18039     toMarkdown() {
18040         return this.text;
18041     }
18042 }
18043 function fillNewlines(text) {
18044     if (text.endsWith('\n')) {
18045         return '\n';
18046     }
18047     else {
18048         return '\n\n';
18049     }
18050 }
18051 //# sourceMappingURL=jsdoc.js.map
18052 ;// CONCATENATED MODULE: ../node_modules/langium/lib/documentation/documentation-provider.js
18053 /******************************************************************************
18054  * Copyright 2023 TypeFox GmbH
18055  * This program and the accompanying materials are made available under the
18056  * terms of the MIT License, which is available in the project root.
18057  ******************************************************************************/
18058 
18059 
18060 class JSDocDocumentationProvider {
18061     constructor(services) {
18062         this.indexManager = services.shared.workspace.IndexManager;
18063         this.commentProvider = services.documentation.CommentProvider;
18064     }
18065     getDocumentation(node) {
18066         const comment = this.commentProvider.getComment(node);
18067         if (comment && isJSDoc(comment)) {
18068             const parsedJSDoc = parseJSDoc(comment);
18069             return parsedJSDoc.toMarkdown({
18070                 renderLink: (link, display) => {
18071                     return this.documentationLinkRenderer(node, link, display);
18072                 },
18073                 renderTag: (tag) => {
18074                     return this.documentationTagRenderer(node, tag);
18075                 }
18076             });
18077         }
18078         return undefined;
18079     }
18080     documentationLinkRenderer(node, name, display) {
18081         var _a;
18082         const description = (_a = this.findNameInPrecomputedScopes(node, name)) !== null && _a !== void 0 ? _a : this.findNameInGlobalScope(node, name);
18083         if (description && description.nameSegment) {
18084             const line = description.nameSegment.range.start.line + 1;
18085             const character = description.nameSegment.range.start.character + 1;
18086             const uri = description.documentUri.with({ fragment: `L${line},${character}` });
18087             return `[${display}](${uri.toString()})`;
18088         }
18089         else {
18090             return undefined;
18091         }
18092     }
18093     documentationTagRenderer(_node, _tag) {
18094         // Fall back to the default tag rendering
18095         return undefined;
18096     }
18097     findNameInPrecomputedScopes(node, name) {
18098         const document = (0,ast_utils/* getDocument */.Me)(node);
18099         const precomputed = document.precomputedScopes;
18100         if (!precomputed) {
18101             return undefined;
18102         }
18103         let currentNode = node;
18104         do {
18105             const allDescriptions = precomputed.get(currentNode);
18106             const description = allDescriptions.find(e => e.name === name);
18107             if (description) {
18108                 return description;
18109             }
18110             currentNode = currentNode.$container;
18111         } while (currentNode);
18112         return undefined;
18113     }
18114     findNameInGlobalScope(node, name) {
18115         const description = this.indexManager.allElements().find(e => e.name === name);
18116         return description;
18117     }
18118 }
18119 //# sourceMappingURL=documentation-provider.js.map
18120 ;// CONCATENATED MODULE: ../node_modules/langium/lib/documentation/comment-provider.js
18121 /******************************************************************************
18122  * Copyright 2023 TypeFox GmbH
18123  * This program and the accompanying materials are made available under the
18124  * terms of the MIT License, which is available in the project root.
18125  ******************************************************************************/
18126 
18127 
18128 class DefaultCommentProvider {
18129     constructor(services) {
18130         this.grammarConfig = () => services.parser.GrammarConfig;
18131     }
18132     getComment(node) {
18133         var _a;
18134         if (isAstNodeWithComment(node)) {
18135             return node.$comment;
18136         }
18137         return (_a = (0,cst_utils/* findCommentNode */.LK)(node.$cstNode, this.grammarConfig().multilineCommentRules)) === null || _a === void 0 ? void 0 : _a.text;
18138     }
18139 }
18140 //# sourceMappingURL=comment-provider.js.map
18141 ;// CONCATENATED MODULE: ../node_modules/langium/lib/parser/async-parser.js
18142 /******************************************************************************
18143  * Copyright 2023 TypeFox GmbH
18144  * This program and the accompanying materials are made available under the
18145  * terms of the MIT License, which is available in the project root.
18146  ******************************************************************************/
18147 
18148 
18149 /**
18150  * Default implementation of the async parser which simply wraps the sync parser in a promise.
18151  *
18152  * @remarks
18153  * A real implementation would create worker threads or web workers to offload the parsing work.
18154  */
18155 class DefaultAsyncParser {
18156     constructor(services) {
18157         this.syncParser = services.parser.LangiumParser;
18158     }
18159     parse(text, _cancelToken) {
18160         return Promise.resolve(this.syncParser.parse(text));
18161     }
18162 }
18163 class AbstractThreadedAsyncParser {
18164     constructor(services) {
18165         /**
18166          * The thread count determines how many threads are used to parse files in parallel.
18167          * The default value is 8. Decreasing this value increases startup performance, but decreases parallel parsing performance.
18168          */
18169         this.threadCount = 8;
18170         /**
18171          * The termination delay determines how long the parser waits for a thread to finish after a cancellation request.
18172          * The default value is 200(ms).
18173          */
18174         this.terminationDelay = 200;
18175         this.workerPool = [];
18176         this.queue = [];
18177         this.hydrator = services.serializer.Hydrator;
18178     }
18179     initializeWorkers() {
18180         while (this.workerPool.length < this.threadCount) {
18181             const worker = this.createWorker();
18182             worker.onReady(() => {
18183                 if (this.queue.length > 0) {
18184                     const deferred = this.queue.shift();
18185                     if (deferred) {
18186                         worker.lock();
18187                         deferred.resolve(worker);
18188                     }
18189                 }
18190             });
18191             this.workerPool.push(worker);
18192         }
18193     }
18194     async parse(text, cancelToken) {
18195         const worker = await this.acquireParserWorker(cancelToken);
18196         const deferred = new Deferred();
18197         let timeout;
18198         // If the cancellation token is requested, we wait for a certain time before terminating the worker.
18199         // Since the cancellation token lives longer than the parsing process, we need to dispose the event listener.
18200         // Otherwise, we might accidentally terminate the worker after the parsing process has finished.
18201         const cancellation = cancelToken.onCancellationRequested(() => {
18202             timeout = setTimeout(() => {
18203                 this.terminateWorker(worker);
18204             }, this.terminationDelay);
18205         });
18206         worker.parse(text).then(result => {
18207             const hydrated = this.hydrator.hydrate(result);
18208             deferred.resolve(hydrated);
18209         }).catch(err => {
18210             deferred.reject(err);
18211         }).finally(() => {
18212             cancellation.dispose();
18213             clearTimeout(timeout);
18214         });
18215         return deferred.promise;
18216     }
18217     terminateWorker(worker) {
18218         worker.terminate();
18219         const index = this.workerPool.indexOf(worker);
18220         if (index >= 0) {
18221             this.workerPool.splice(index, 1);
18222         }
18223     }
18224     async acquireParserWorker(cancelToken) {
18225         this.initializeWorkers();
18226         for (const worker of this.workerPool) {
18227             if (worker.ready) {
18228                 worker.lock();
18229                 return worker;
18230             }
18231         }
18232         const deferred = new Deferred();
18233         cancelToken.onCancellationRequested(() => {
18234             const index = this.queue.indexOf(deferred);
18235             if (index >= 0) {
18236                 this.queue.splice(index, 1);
18237             }
18238             deferred.reject(OperationCancelled);
18239         });
18240         this.queue.push(deferred);
18241         return deferred.promise;
18242     }
18243 }
18244 class ParserWorker {
18245     get ready() {
18246         return this._ready;
18247     }
18248     get onReady() {
18249         return this.onReadyEmitter.event;
18250     }
18251     constructor(sendMessage, onMessage, onError, terminate) {
18252         this.onReadyEmitter = new Emitter();
18253         this.deferred = new Deferred();
18254         this._ready = true;
18255         this._parsing = false;
18256         this.sendMessage = sendMessage;
18257         this._terminate = terminate;
18258         onMessage(result => {
18259             const parseResult = result;
18260             this.deferred.resolve(parseResult);
18261             this.unlock();
18262         });
18263         onError(error => {
18264             this.deferred.reject(error);
18265             this.unlock();
18266         });
18267     }
18268     terminate() {
18269         this.deferred.reject(OperationCancelled);
18270         this._terminate();
18271     }
18272     lock() {
18273         this._ready = false;
18274     }
18275     unlock() {
18276         this._parsing = false;
18277         this._ready = true;
18278         this.onReadyEmitter.fire();
18279     }
18280     parse(text) {
18281         if (this._parsing) {
18282             throw new Error('Parser worker is busy');
18283         }
18284         this._parsing = true;
18285         this.deferred = new Deferred();
18286         this.sendMessage(text);
18287         return this.deferred.promise;
18288     }
18289 }
18290 //# sourceMappingURL=async-parser.js.map
18291 ;// CONCATENATED MODULE: ../node_modules/langium/lib/workspace/workspace-lock.js
18292 /******************************************************************************
18293  * Copyright 2023 TypeFox GmbH
18294  * This program and the accompanying materials are made available under the
18295  * terms of the MIT License, which is available in the project root.
18296  ******************************************************************************/
18297 
18298 
18299 class DefaultWorkspaceLock {
18300     constructor() {
18301         this.previousTokenSource = new cancellation.CancellationTokenSource();
18302         this.writeQueue = [];
18303         this.readQueue = [];
18304         this.done = true;
18305     }
18306     write(action) {
18307         this.cancelWrite();
18308         const tokenSource = startCancelableOperation();
18309         this.previousTokenSource = tokenSource;
18310         return this.enqueue(this.writeQueue, action, tokenSource.token);
18311     }
18312     read(action) {
18313         return this.enqueue(this.readQueue, action);
18314     }
18315     enqueue(queue, action, cancellationToken = cancellation.CancellationToken.None) {
18316         const deferred = new promise_utils_Deferred();
18317         const entry = {
18318             action,
18319             deferred,
18320             cancellationToken
18321         };
18322         queue.push(entry);
18323         this.performNextOperation();
18324         return deferred.promise;
18325     }
18326     async performNextOperation() {
18327         if (!this.done) {
18328             return;
18329         }
18330         const entries = [];
18331         if (this.writeQueue.length > 0) {
18332             // Just perform the next write action
18333             entries.push(this.writeQueue.shift());
18334         }
18335         else if (this.readQueue.length > 0) {
18336             // Empty the read queue and perform all actions in parallel
18337             entries.push(...this.readQueue.splice(0, this.readQueue.length));
18338         }
18339         else {
18340             return;
18341         }
18342         this.done = false;
18343         await Promise.all(entries.map(async ({ action, deferred, cancellationToken }) => {
18344             try {
18345                 // Move the execution of the action to the next event loop tick via `Promise.resolve()`
18346                 const result = await Promise.resolve().then(() => action(cancellationToken));
18347                 deferred.resolve(result);
18348             }
18349             catch (err) {
18350                 if (isOperationCancelled(err)) {
18351                     // If the operation was cancelled, we don't want to reject the promise
18352                     deferred.resolve(undefined);
18353                 }
18354                 else {
18355                     deferred.reject(err);
18356                 }
18357             }
18358         }));
18359         this.done = true;
18360         this.performNextOperation();
18361     }
18362     cancelWrite() {
18363         this.previousTokenSource.cancel();
18364     }
18365 }
18366 //# sourceMappingURL=workspace-lock.js.map
18367 ;// CONCATENATED MODULE: ../node_modules/langium/lib/serializer/hydrator.js
18368 /******************************************************************************
18369  * Copyright 2024 TypeFox GmbH
18370  * This program and the accompanying materials are made available under the
18371  * terms of the MIT License, which is available in the project root.
18372  ******************************************************************************/
18373 
18374 
18375 
18376 
18377 
18378 
18379 class DefaultHydrator {
18380     constructor(services) {
18381         this.grammarElementIdMap = new BiMap();
18382         this.tokenTypeIdMap = new BiMap();
18383         this.grammar = services.Grammar;
18384         this.lexer = services.parser.Lexer;
18385         this.linker = services.references.Linker;
18386     }
18387     dehydrate(result) {
18388         return {
18389             lexerErrors: result.lexerErrors,
18390             lexerReport: result.lexerReport ? this.dehydrateLexerReport(result.lexerReport) : undefined,
18391             // We need to create shallow copies of the errors
18392             // The original errors inherit from the `Error` class, which is not transferable across worker threads
18393             parserErrors: result.parserErrors.map(e => (Object.assign(Object.assign({}, e), { message: e.message }))),
18394             value: this.dehydrateAstNode(result.value, this.createDehyrationContext(result.value))
18395         };
18396     }
18397     dehydrateLexerReport(lexerReport) {
18398         // By default, lexer reports are serializable
18399         return lexerReport;
18400     }
18401     createDehyrationContext(node) {
18402         const astNodes = new Map();
18403         const cstNodes = new Map();
18404         for (const astNode of (0,ast_utils/* streamAst */.Zc)(node)) {
18405             astNodes.set(astNode, {});
18406         }
18407         if (node.$cstNode) {
18408             for (const cstNode of (0,cst_utils/* streamCst */._t)(node.$cstNode)) {
18409                 cstNodes.set(cstNode, {});
18410             }
18411         }
18412         return {
18413             astNodes,
18414             cstNodes
18415         };
18416     }
18417     dehydrateAstNode(node, context) {
18418         const obj = context.astNodes.get(node);
18419         obj.$type = node.$type;
18420         obj.$containerIndex = node.$containerIndex;
18421         obj.$containerProperty = node.$containerProperty;
18422         if (node.$cstNode !== undefined) {
18423             obj.$cstNode = this.dehydrateCstNode(node.$cstNode, context);
18424         }
18425         for (const [name, value] of Object.entries(node)) {
18426             if (name.startsWith('$')) {
18427                 continue;
18428             }
18429             if (Array.isArray(value)) {
18430                 const arr = [];
18431                 obj[name] = arr;
18432                 for (const item of value) {
18433                     if ((0,syntax_tree/* isAstNode */.xA)(item)) {
18434                         arr.push(this.dehydrateAstNode(item, context));
18435                     }
18436                     else if ((0,syntax_tree/* isReference */.Yk)(item)) {
18437                         arr.push(this.dehydrateReference(item, context));
18438                     }
18439                     else {
18440                         arr.push(item);
18441                     }
18442                 }
18443             }
18444             else if ((0,syntax_tree/* isAstNode */.xA)(value)) {
18445                 obj[name] = this.dehydrateAstNode(value, context);
18446             }
18447             else if ((0,syntax_tree/* isReference */.Yk)(value)) {
18448                 obj[name] = this.dehydrateReference(value, context);
18449             }
18450             else if (value !== undefined) {
18451                 obj[name] = value;
18452             }
18453         }
18454         return obj;
18455     }
18456     dehydrateReference(reference, context) {
18457         const obj = {};
18458         obj.$refText = reference.$refText;
18459         if (reference.$refNode) {
18460             obj.$refNode = context.cstNodes.get(reference.$refNode);
18461         }
18462         return obj;
18463     }
18464     dehydrateCstNode(node, context) {
18465         const cstNode = context.cstNodes.get(node);
18466         if ((0,syntax_tree/* isRootCstNode */.U8)(node)) {
18467             cstNode.fullText = node.fullText;
18468         }
18469         else {
18470             // Note: This returns undefined for hidden nodes (i.e. comments)
18471             cstNode.grammarSource = this.getGrammarElementId(node.grammarSource);
18472         }
18473         cstNode.hidden = node.hidden;
18474         cstNode.astNode = context.astNodes.get(node.astNode);
18475         if ((0,syntax_tree/* isCompositeCstNode */.al)(node)) {
18476             cstNode.content = node.content.map(child => this.dehydrateCstNode(child, context));
18477         }
18478         else if ((0,syntax_tree/* isLeafCstNode */.dm)(node)) {
18479             cstNode.tokenType = node.tokenType.name;
18480             cstNode.offset = node.offset;
18481             cstNode.length = node.length;
18482             cstNode.startLine = node.range.start.line;
18483             cstNode.startColumn = node.range.start.character;
18484             cstNode.endLine = node.range.end.line;
18485             cstNode.endColumn = node.range.end.character;
18486         }
18487         return cstNode;
18488     }
18489     hydrate(result) {
18490         const node = result.value;
18491         const context = this.createHydrationContext(node);
18492         if ('$cstNode' in node) {
18493             this.hydrateCstNode(node.$cstNode, context);
18494         }
18495         return {
18496             lexerErrors: result.lexerErrors,
18497             lexerReport: result.lexerReport,
18498             parserErrors: result.parserErrors,
18499             value: this.hydrateAstNode(node, context)
18500         };
18501     }
18502     createHydrationContext(node) {
18503         const astNodes = new Map();
18504         const cstNodes = new Map();
18505         for (const astNode of (0,ast_utils/* streamAst */.Zc)(node)) {
18506             astNodes.set(astNode, {});
18507         }
18508         let root;
18509         if (node.$cstNode) {
18510             for (const cstNode of (0,cst_utils/* streamCst */._t)(node.$cstNode)) {
18511                 let cst;
18512                 if ('fullText' in cstNode) {
18513                     cst = new RootCstNodeImpl(cstNode.fullText);
18514                     root = cst;
18515                 }
18516                 else if ('content' in cstNode) {
18517                     cst = new CompositeCstNodeImpl();
18518                 }
18519                 else if ('tokenType' in cstNode) {
18520                     cst = this.hydrateCstLeafNode(cstNode);
18521                 }
18522                 if (cst) {
18523                     cstNodes.set(cstNode, cst);
18524                     cst.root = root;
18525                 }
18526             }
18527         }
18528         return {
18529             astNodes,
18530             cstNodes
18531         };
18532     }
18533     hydrateAstNode(node, context) {
18534         const astNode = context.astNodes.get(node);
18535         astNode.$type = node.$type;
18536         astNode.$containerIndex = node.$containerIndex;
18537         astNode.$containerProperty = node.$containerProperty;
18538         if (node.$cstNode) {
18539             astNode.$cstNode = context.cstNodes.get(node.$cstNode);
18540         }
18541         for (const [name, value] of Object.entries(node)) {
18542             if (name.startsWith('$')) {
18543                 continue;
18544             }
18545             if (Array.isArray(value)) {
18546                 const arr = [];
18547                 astNode[name] = arr;
18548                 for (const item of value) {
18549                     if ((0,syntax_tree/* isAstNode */.xA)(item)) {
18550                         arr.push(this.setParent(this.hydrateAstNode(item, context), astNode));
18551                     }
18552                     else if ((0,syntax_tree/* isReference */.Yk)(item)) {
18553                         arr.push(this.hydrateReference(item, astNode, name, context));
18554                     }
18555                     else {
18556                         arr.push(item);
18557                     }
18558                 }
18559             }
18560             else if ((0,syntax_tree/* isAstNode */.xA)(value)) {
18561                 astNode[name] = this.setParent(this.hydrateAstNode(value, context), astNode);
18562             }
18563             else if ((0,syntax_tree/* isReference */.Yk)(value)) {
18564                 astNode[name] = this.hydrateReference(value, astNode, name, context);
18565             }
18566             else if (value !== undefined) {
18567                 astNode[name] = value;
18568             }
18569         }
18570         return astNode;
18571     }
18572     setParent(node, parent) {
18573         node.$container = parent;
18574         return node;
18575     }
18576     hydrateReference(reference, node, name, context) {
18577         return this.linker.buildReference(node, name, context.cstNodes.get(reference.$refNode), reference.$refText);
18578     }
18579     hydrateCstNode(cstNode, context, num = 0) {
18580         const cstNodeObj = context.cstNodes.get(cstNode);
18581         if (typeof cstNode.grammarSource === 'number') {
18582             cstNodeObj.grammarSource = this.getGrammarElement(cstNode.grammarSource);
18583         }
18584         cstNodeObj.astNode = context.astNodes.get(cstNode.astNode);
18585         if ((0,syntax_tree/* isCompositeCstNode */.al)(cstNodeObj)) {
18586             for (const child of cstNode.content) {
18587                 const hydrated = this.hydrateCstNode(child, context, num++);
18588                 cstNodeObj.content.push(hydrated);
18589             }
18590         }
18591         return cstNodeObj;
18592     }
18593     hydrateCstLeafNode(cstNode) {
18594         const tokenType = this.getTokenType(cstNode.tokenType);
18595         const offset = cstNode.offset;
18596         const length = cstNode.length;
18597         const startLine = cstNode.startLine;
18598         const startColumn = cstNode.startColumn;
18599         const endLine = cstNode.endLine;
18600         const endColumn = cstNode.endColumn;
18601         const hidden = cstNode.hidden;
18602         const node = new LeafCstNodeImpl(offset, length, {
18603             start: {
18604                 line: startLine,
18605                 character: startColumn
18606             },
18607             end: {
18608                 line: endLine,
18609                 character: endColumn
18610             }
18611         }, tokenType, hidden);
18612         return node;
18613     }
18614     getTokenType(name) {
18615         return this.lexer.definition[name];
18616     }
18617     getGrammarElementId(node) {
18618         if (!node) {
18619             return undefined;
18620         }
18621         if (this.grammarElementIdMap.size === 0) {
18622             this.createGrammarElementIdMap();
18623         }
18624         return this.grammarElementIdMap.get(node);
18625     }
18626     getGrammarElement(id) {
18627         if (this.grammarElementIdMap.size === 0) {
18628             this.createGrammarElementIdMap();
18629         }
18630         const element = this.grammarElementIdMap.getKey(id);
18631         return element;
18632     }
18633     createGrammarElementIdMap() {
18634         let id = 0;
18635         for (const element of (0,ast_utils/* streamAst */.Zc)(this.grammar)) {
18636             if ((0,ast/* isAbstractElement */.zJ)(element)) {
18637                 this.grammarElementIdMap.set(element, id++);
18638             }
18639         }
18640     }
18641 }
18642 //# sourceMappingURL=hydrator.js.map
18643 ;// CONCATENATED MODULE: ../node_modules/langium/lib/default-module.js
18644 /******************************************************************************
18645  * Copyright 2021 TypeFox GmbH
18646  * This program and the accompanying materials are made available under the
18647  * terms of the MIT License, which is available in the project root.
18648 ******************************************************************************/
18649 
18650 
18651 
18652 
18653 
18654 
18655 
18656 
18657 
18658 
18659 
18660 
18661 
18662 
18663 
18664 
18665 
18666 
18667 
18668 
18669 
18670 
18671 
18672 
18673 
18674 
18675 
18676 
18677 /**
18678  * Creates a dependency injection module configuring the default core services.
18679  * This is a set of services that are dedicated to a specific language.
18680  */
18681 function createDefaultCoreModule(context) {
18682     return {
18683         documentation: {
18684             CommentProvider: (services) => new DefaultCommentProvider(services),
18685             DocumentationProvider: (services) => new JSDocDocumentationProvider(services)
18686         },
18687         parser: {
18688             AsyncParser: (services) => new DefaultAsyncParser(services),
18689             GrammarConfig: (services) => createGrammarConfig(services),
18690             LangiumParser: (services) => createLangiumParser(services),
18691             CompletionParser: (services) => createCompletionParser(services),
18692             ValueConverter: () => new value_converter/* DefaultValueConverter */.t(),
18693             TokenBuilder: () => new token_builder/* DefaultTokenBuilder */.P(),
18694             Lexer: (services) => new DefaultLexer(services),
18695             ParserErrorMessageProvider: () => new LangiumParserErrorMessageProvider(),
18696             LexerErrorMessageProvider: () => new DefaultLexerErrorMessageProvider()
18697         },
18698         workspace: {
18699             AstNodeLocator: () => new DefaultAstNodeLocator(),
18700             AstNodeDescriptionProvider: (services) => new DefaultAstNodeDescriptionProvider(services),
18701             ReferenceDescriptionProvider: (services) => new DefaultReferenceDescriptionProvider(services)
18702         },
18703         references: {
18704             Linker: (services) => new DefaultLinker(services),
18705             NameProvider: () => new DefaultNameProvider(),
18706             ScopeProvider: (services) => new DefaultScopeProvider(services),
18707             ScopeComputation: (services) => new DefaultScopeComputation(services),
18708             References: (services) => new DefaultReferences(services)
18709         },
18710         serializer: {
18711             Hydrator: (services) => new DefaultHydrator(services),
18712             JsonSerializer: (services) => new DefaultJsonSerializer(services)
18713         },
18714         validation: {
18715             DocumentValidator: (services) => new DefaultDocumentValidator(services),
18716             ValidationRegistry: (services) => new ValidationRegistry(services)
18717         },
18718         shared: () => context.shared
18719     };
18720 }
18721 /**
18722  * Creates a dependency injection module configuring the default shared core services.
18723  * This is the set of services that are shared between multiple languages.
18724  */
18725 function createDefaultSharedCoreModule(context) {
18726     return {
18727         ServiceRegistry: (services) => new DefaultServiceRegistry(services),
18728         workspace: {
18729             LangiumDocuments: (services) => new DefaultLangiumDocuments(services),
18730             LangiumDocumentFactory: (services) => new DefaultLangiumDocumentFactory(services),
18731             DocumentBuilder: (services) => new DefaultDocumentBuilder(services),
18732             IndexManager: (services) => new DefaultIndexManager(services),
18733             WorkspaceManager: (services) => new DefaultWorkspaceManager(services),
18734             FileSystemProvider: (services) => context.fileSystemProvider(services),
18735             WorkspaceLock: () => new DefaultWorkspaceLock(),
18736             ConfigurationProvider: (services) => new DefaultConfigurationProvider(services)
18737         }
18738     };
18739 }
18740 //# sourceMappingURL=default-module.js.map
18741 
18742 /***/ }),
18743 
18744 /***/ 81210:
18745 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
18746 
18747 "use strict";
18748 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
18749 /* harmony export */   f3: () => (/* binding */ inject)
18750 /* harmony export */ });
18751 /* unused harmony exports Module, eagerLoad */
18752 /******************************************************************************
18753  * Copyright 2021 TypeFox GmbH
18754  * This program and the accompanying materials are made available under the
18755  * terms of the MIT License, which is available in the project root.
18756  ******************************************************************************/
18757 var Module;
18758 (function (Module) {
18759     Module.merge = (m1, m2) => _merge(_merge({}, m1), m2);
18760 })(Module || (Module = {}));
18761 /**
18762  * Given a set of modules, the inject function returns a lazily evaluated injector
18763  * that injects dependencies into the requested service when it is requested the
18764  * first time. Subsequent requests will return the same service.
18765  *
18766  * In the case of cyclic dependencies, an Error will be thrown. This can be fixed
18767  * by injecting a provider `() => T` instead of a `T`.
18768  *
18769  * Please note that the arguments may be objects or arrays. However, the result will
18770  * be an object. Using it with for..of will have no effect.
18771  *
18772  * @param module1 first Module
18773  * @param module2 (optional) second Module
18774  * @param module3 (optional) third Module
18775  * @param module4 (optional) fourth Module
18776  * @param module5 (optional) fifth Module
18777  * @param module6 (optional) sixth Module
18778  * @param module7 (optional) seventh Module
18779  * @param module8 (optional) eighth Module
18780  * @param module9 (optional) ninth Module
18781  * @returns a new object of type I
18782  */
18783 function inject(module1, module2, module3, module4, module5, module6, module7, module8, module9) {
18784     const module = [module1, module2, module3, module4, module5, module6, module7, module8, module9].reduce(_merge, {});
18785     return _inject(module);
18786 }
18787 const isProxy = Symbol('isProxy');
18788 /**
18789  * Eagerly load all services in the given dependency injection container. This is sometimes
18790  * necessary because services can register event listeners in their constructors.
18791  */
18792 function eagerLoad(item) {
18793     if (item && item[isProxy]) {
18794         for (const value of Object.values(item)) {
18795             eagerLoad(value);
18796         }
18797     }
18798     return item;
18799 }
18800 /**
18801  * Helper function that returns an injector by creating a proxy.
18802  * Invariant: injector is of type I. If injector is undefined, then T = I.
18803  */
18804 function _inject(module, injector) {
18805     const proxy = new Proxy({}, {
18806         deleteProperty: () => false,
18807         set: () => {
18808             throw new Error('Cannot set property on injected service container');
18809         },
18810         get: (obj, prop) => {
18811             if (prop === isProxy) {
18812                 return true;
18813             }
18814             else {
18815                 return _resolve(obj, prop, module, injector || proxy);
18816             }
18817         },
18818         getOwnPropertyDescriptor: (obj, prop) => (_resolve(obj, prop, module, injector || proxy), Object.getOwnPropertyDescriptor(obj, prop)), // used by for..in
18819         has: (_, prop) => prop in module, // used by ..in..
18820         ownKeys: () => [...Object.getOwnPropertyNames(module)] // used by for..in
18821     });
18822     return proxy;
18823 }
18824 /**
18825  * Internally used to tag a requested dependency, directly before calling the factory.
18826  * This allows us to find cycles during instance creation.
18827  */
18828 const __requested__ = Symbol();
18829 /**
18830  * Returns the value `obj[prop]`. If the value does not exist, yet, it is resolved from
18831  * the module description. The result of service factories is cached. Groups are
18832  * recursively proxied.
18833  *
18834  * @param obj an object holding all group proxies and services
18835  * @param prop the key of a value within obj
18836  * @param module an object containing groups and service factories
18837  * @param injector the first level proxy that provides access to all values
18838  * @returns the requested value `obj[prop]`
18839  * @throws Error if a dependency cycle is detected
18840  */
18841 function _resolve(obj, prop, module, injector) {
18842     if (prop in obj) {
18843         if (obj[prop] instanceof Error) {
18844             throw new Error('Construction failure. Please make sure that your dependencies are constructable.', { cause: obj[prop] });
18845         }
18846         if (obj[prop] === __requested__) {
18847             throw new Error('Cycle detected. Please make "' + String(prop) + '" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');
18848         }
18849         return obj[prop];
18850     }
18851     else if (prop in module) {
18852         const value = module[prop];
18853         obj[prop] = __requested__;
18854         try {
18855             obj[prop] = (typeof value === 'function') ? value(injector) : _inject(value, injector);
18856         }
18857         catch (error) {
18858             obj[prop] = error instanceof Error ? error : undefined;
18859             throw error;
18860         }
18861         return obj[prop];
18862     }
18863     else {
18864         return undefined;
18865     }
18866 }
18867 /**
18868  * Performs a deep-merge of two modules by writing source entries into the target module.
18869  *
18870  * @param target the module which is written
18871  * @param source the module which is read
18872  * @returns the target module
18873  */
18874 function _merge(target, source) {
18875     if (source) {
18876         for (const [key, value2] of Object.entries(source)) {
18877             if (value2 !== undefined) {
18878                 const value1 = target[key];
18879                 if (value1 !== null && value2 !== null && typeof value1 === 'object' && typeof value2 === 'object') {
18880                     target[key] = _merge(value1, value2);
18881                 }
18882                 else {
18883                     target[key] = value2;
18884                 }
18885             }
18886         }
18887     }
18888     return target;
18889 }
18890 //# sourceMappingURL=dependency-injection.js.map
18891 
18892 /***/ }),
18893 
18894 /***/ 34905:
18895 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
18896 
18897 "use strict";
18898 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
18899 /* harmony export */   B7: () => (/* binding */ isAssignment),
18900 /* harmony export */   Bf: () => (/* binding */ isCharacterRange),
18901 /* harmony export */   Bi: () => (/* binding */ isNegatedToken),
18902 /* harmony export */   F8: () => (/* binding */ isDisjunction),
18903 /* harmony export */   F9: () => (/* binding */ isParserRule),
18904 /* harmony export */   Ii: () => (/* binding */ isNegation),
18905 /* harmony export */   Iy: () => (/* binding */ isSimpleType),
18906 /* harmony export */   Ki: () => (/* binding */ isCrossReference),
18907 /* harmony export */   L: () => (/* binding */ isBooleanLiteral),
18908 /* harmony export */   LG: () => (/* binding */ isAction),
18909 /* harmony export */   MS: () => (/* binding */ isTerminalRule),
18910 /* harmony export */   MZ: () => (/* binding */ isAlternatives),
18911 /* harmony export */   Mp: () => (/* binding */ isReturnType),
18912 /* harmony export */   OG: () => (/* binding */ isUntilToken),
18913 /* harmony export */   P9: () => (/* binding */ isType),
18914 /* harmony export */   QV: () => (/* binding */ isInterface),
18915 /* harmony export */   SV: () => (/* binding */ LangiumGrammarAstReflection),
18916 /* harmony export */   S_: () => (/* binding */ isInferredType),
18917 /* harmony export */   Sg: () => (/* binding */ isRegexToken),
18918 /* harmony export */   TB: () => (/* binding */ isConjunction),
18919 /* harmony export */   V7: () => (/* binding */ isTerminalAlternatives),
18920 /* harmony export */   W1: () => (/* binding */ isUnorderedGroup),
18921 /* harmony export */   X9: () => (/* binding */ isTerminalGroup),
18922 /* harmony export */   gf: () => (/* binding */ isTerminalRuleCall),
18923 /* harmony export */   p1: () => (/* binding */ isKeyword),
18924 /* harmony export */   qm: () => (/* binding */ isWildcard),
18925 /* harmony export */   rT: () => (/* binding */ isEndOfFile),
18926 /* harmony export */   t3: () => (/* binding */ isRuleCall),
18927 /* harmony export */   ty: () => (/* binding */ isGroup),
18928 /* harmony export */   yW: () => (/* binding */ isParameterReference),
18929 /* harmony export */   zJ: () => (/* binding */ isAbstractElement)
18930 /* harmony export */ });
18931 /* unused harmony exports LangiumGrammarTerminals, AbstractRule, isAbstractRule, AbstractType, isAbstractType, Condition, isCondition, isFeatureName, isPrimitiveType, TypeDefinition, isTypeDefinition, ValueLiteral, isValueLiteral, AbstractElement, ArrayLiteral, isArrayLiteral, ArrayType, isArrayType, BooleanLiteral, Conjunction, Disjunction, Grammar, isGrammar, GrammarImport, isGrammarImport, InferredType, Interface, NamedArgument, isNamedArgument, Negation, NumberLiteral, isNumberLiteral, Parameter, isParameter, ParameterReference, ParserRule, ReferenceType, isReferenceType, ReturnType, SimpleType, StringLiteral, isStringLiteral, TerminalRule, Type, TypeAttribute, isTypeAttribute, UnionType, isUnionType, Action, Alternatives, Assignment, CharacterRange, CrossReference, EndOfFile, Group, Keyword, NegatedToken, RegexToken, RuleCall, TerminalAlternatives, TerminalGroup, TerminalRuleCall, UnorderedGroup, UntilToken, Wildcard, reflection */
18932 /* harmony import */ var _syntax_tree_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91303);
18933 /******************************************************************************
18934  * This file was generated by langium-cli 3.3.0.
18935  * DO NOT EDIT MANUALLY!
18936  ******************************************************************************/
18937 
18938 const LangiumGrammarTerminals = {
18939     ID: /\^?[_a-zA-Z][\w_]*/,
18940     STRING: /"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,
18941     NUMBER: /NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,
18942     RegexLiteral: /\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,
18943     WS: /\s+/,
18944     ML_COMMENT: /\/\*[\s\S]*?\*\//,
18945     SL_COMMENT: /\/\/[^\n\r]*/,
18946 };
18947 const AbstractRule = 'AbstractRule';
18948 function isAbstractRule(item) {
18949     return reflection.isInstance(item, AbstractRule);
18950 }
18951 const AbstractType = 'AbstractType';
18952 function isAbstractType(item) {
18953     return reflection.isInstance(item, AbstractType);
18954 }
18955 const Condition = 'Condition';
18956 function isCondition(item) {
18957     return reflection.isInstance(item, Condition);
18958 }
18959 function isFeatureName(item) {
18960     return isPrimitiveType(item) || item === 'current' || item === 'entry' || item === 'extends' || item === 'false' || item === 'fragment' || item === 'grammar' || item === 'hidden' || item === 'import' || item === 'interface' || item === 'returns' || item === 'terminal' || item === 'true' || item === 'type' || item === 'infer' || item === 'infers' || item === 'with' || (typeof item === 'string' && (/\^?[_a-zA-Z][\w_]*/.test(item)));
18961 }
18962 function isPrimitiveType(item) {
18963     return item === 'string' || item === 'number' || item === 'boolean' || item === 'Date' || item === 'bigint';
18964 }
18965 const TypeDefinition = 'TypeDefinition';
18966 function isTypeDefinition(item) {
18967     return reflection.isInstance(item, TypeDefinition);
18968 }
18969 const ValueLiteral = 'ValueLiteral';
18970 function isValueLiteral(item) {
18971     return reflection.isInstance(item, ValueLiteral);
18972 }
18973 const AbstractElement = 'AbstractElement';
18974 function isAbstractElement(item) {
18975     return reflection.isInstance(item, AbstractElement);
18976 }
18977 const ArrayLiteral = 'ArrayLiteral';
18978 function isArrayLiteral(item) {
18979     return reflection.isInstance(item, ArrayLiteral);
18980 }
18981 const ArrayType = 'ArrayType';
18982 function isArrayType(item) {
18983     return reflection.isInstance(item, ArrayType);
18984 }
18985 const BooleanLiteral = 'BooleanLiteral';
18986 function isBooleanLiteral(item) {
18987     return reflection.isInstance(item, BooleanLiteral);
18988 }
18989 const Conjunction = 'Conjunction';
18990 function isConjunction(item) {
18991     return reflection.isInstance(item, Conjunction);
18992 }
18993 const Disjunction = 'Disjunction';
18994 function isDisjunction(item) {
18995     return reflection.isInstance(item, Disjunction);
18996 }
18997 const Grammar = 'Grammar';
18998 function isGrammar(item) {
18999     return reflection.isInstance(item, Grammar);
19000 }
19001 const GrammarImport = 'GrammarImport';
19002 function isGrammarImport(item) {
19003     return reflection.isInstance(item, GrammarImport);
19004 }
19005 const InferredType = 'InferredType';
19006 function isInferredType(item) {
19007     return reflection.isInstance(item, InferredType);
19008 }
19009 const Interface = 'Interface';
19010 function isInterface(item) {
19011     return reflection.isInstance(item, Interface);
19012 }
19013 const NamedArgument = 'NamedArgument';
19014 function isNamedArgument(item) {
19015     return reflection.isInstance(item, NamedArgument);
19016 }
19017 const Negation = 'Negation';
19018 function isNegation(item) {
19019     return reflection.isInstance(item, Negation);
19020 }
19021 const NumberLiteral = 'NumberLiteral';
19022 function isNumberLiteral(item) {
19023     return reflection.isInstance(item, NumberLiteral);
19024 }
19025 const Parameter = 'Parameter';
19026 function isParameter(item) {
19027     return reflection.isInstance(item, Parameter);
19028 }
19029 const ParameterReference = 'ParameterReference';
19030 function isParameterReference(item) {
19031     return reflection.isInstance(item, ParameterReference);
19032 }
19033 const ParserRule = 'ParserRule';
19034 function isParserRule(item) {
19035     return reflection.isInstance(item, ParserRule);
19036 }
19037 const ReferenceType = 'ReferenceType';
19038 function isReferenceType(item) {
19039     return reflection.isInstance(item, ReferenceType);
19040 }
19041 const ReturnType = 'ReturnType';
19042 function isReturnType(item) {
19043     return reflection.isInstance(item, ReturnType);
19044 }
19045 const SimpleType = 'SimpleType';
19046 function isSimpleType(item) {
19047     return reflection.isInstance(item, SimpleType);
19048 }
19049 const StringLiteral = 'StringLiteral';
19050 function isStringLiteral(item) {
19051     return reflection.isInstance(item, StringLiteral);
19052 }
19053 const TerminalRule = 'TerminalRule';
19054 function isTerminalRule(item) {
19055     return reflection.isInstance(item, TerminalRule);
19056 }
19057 const Type = 'Type';
19058 function isType(item) {
19059     return reflection.isInstance(item, Type);
19060 }
19061 const TypeAttribute = 'TypeAttribute';
19062 function isTypeAttribute(item) {
19063     return reflection.isInstance(item, TypeAttribute);
19064 }
19065 const UnionType = 'UnionType';
19066 function isUnionType(item) {
19067     return reflection.isInstance(item, UnionType);
19068 }
19069 const Action = 'Action';
19070 function isAction(item) {
19071     return reflection.isInstance(item, Action);
19072 }
19073 const Alternatives = 'Alternatives';
19074 function isAlternatives(item) {
19075     return reflection.isInstance(item, Alternatives);
19076 }
19077 const Assignment = 'Assignment';
19078 function isAssignment(item) {
19079     return reflection.isInstance(item, Assignment);
19080 }
19081 const CharacterRange = 'CharacterRange';
19082 function isCharacterRange(item) {
19083     return reflection.isInstance(item, CharacterRange);
19084 }
19085 const CrossReference = 'CrossReference';
19086 function isCrossReference(item) {
19087     return reflection.isInstance(item, CrossReference);
19088 }
19089 const EndOfFile = 'EndOfFile';
19090 function isEndOfFile(item) {
19091     return reflection.isInstance(item, EndOfFile);
19092 }
19093 const Group = 'Group';
19094 function isGroup(item) {
19095     return reflection.isInstance(item, Group);
19096 }
19097 const Keyword = 'Keyword';
19098 function isKeyword(item) {
19099     return reflection.isInstance(item, Keyword);
19100 }
19101 const NegatedToken = 'NegatedToken';
19102 function isNegatedToken(item) {
19103     return reflection.isInstance(item, NegatedToken);
19104 }
19105 const RegexToken = 'RegexToken';
19106 function isRegexToken(item) {
19107     return reflection.isInstance(item, RegexToken);
19108 }
19109 const RuleCall = 'RuleCall';
19110 function isRuleCall(item) {
19111     return reflection.isInstance(item, RuleCall);
19112 }
19113 const TerminalAlternatives = 'TerminalAlternatives';
19114 function isTerminalAlternatives(item) {
19115     return reflection.isInstance(item, TerminalAlternatives);
19116 }
19117 const TerminalGroup = 'TerminalGroup';
19118 function isTerminalGroup(item) {
19119     return reflection.isInstance(item, TerminalGroup);
19120 }
19121 const TerminalRuleCall = 'TerminalRuleCall';
19122 function isTerminalRuleCall(item) {
19123     return reflection.isInstance(item, TerminalRuleCall);
19124 }
19125 const UnorderedGroup = 'UnorderedGroup';
19126 function isUnorderedGroup(item) {
19127     return reflection.isInstance(item, UnorderedGroup);
19128 }
19129 const UntilToken = 'UntilToken';
19130 function isUntilToken(item) {
19131     return reflection.isInstance(item, UntilToken);
19132 }
19133 const Wildcard = 'Wildcard';
19134 function isWildcard(item) {
19135     return reflection.isInstance(item, Wildcard);
19136 }
19137 class LangiumGrammarAstReflection extends _syntax_tree_js__WEBPACK_IMPORTED_MODULE_0__/* .AbstractAstReflection */ .$v {
19138     getAllTypes() {
19139         return [AbstractElement, AbstractRule, AbstractType, Action, Alternatives, ArrayLiteral, ArrayType, Assignment, BooleanLiteral, CharacterRange, Condition, Conjunction, CrossReference, Disjunction, EndOfFile, Grammar, GrammarImport, Group, InferredType, Interface, Keyword, NamedArgument, NegatedToken, Negation, NumberLiteral, Parameter, ParameterReference, ParserRule, ReferenceType, RegexToken, ReturnType, RuleCall, SimpleType, StringLiteral, TerminalAlternatives, TerminalGroup, TerminalRule, TerminalRuleCall, Type, TypeAttribute, TypeDefinition, UnionType, UnorderedGroup, UntilToken, ValueLiteral, Wildcard];
19140     }
19141     computeIsSubtype(subtype, supertype) {
19142         switch (subtype) {
19143             case Action:
19144             case Alternatives:
19145             case Assignment:
19146             case CharacterRange:
19147             case CrossReference:
19148             case EndOfFile:
19149             case Group:
19150             case Keyword:
19151             case NegatedToken:
19152             case RegexToken:
19153             case RuleCall:
19154             case TerminalAlternatives:
19155             case TerminalGroup:
19156             case TerminalRuleCall:
19157             case UnorderedGroup:
19158             case UntilToken:
19159             case Wildcard: {
19160                 return this.isSubtype(AbstractElement, supertype);
19161             }
19162             case ArrayLiteral:
19163             case NumberLiteral:
19164             case StringLiteral: {
19165                 return this.isSubtype(ValueLiteral, supertype);
19166             }
19167             case ArrayType:
19168             case ReferenceType:
19169             case SimpleType:
19170             case UnionType: {
19171                 return this.isSubtype(TypeDefinition, supertype);
19172             }
19173             case BooleanLiteral: {
19174                 return this.isSubtype(Condition, supertype) || this.isSubtype(ValueLiteral, supertype);
19175             }
19176             case Conjunction:
19177             case Disjunction:
19178             case Negation:
19179             case ParameterReference: {
19180                 return this.isSubtype(Condition, supertype);
19181             }
19182             case InferredType:
19183             case Interface:
19184             case Type: {
19185                 return this.isSubtype(AbstractType, supertype);
19186             }
19187             case ParserRule: {
19188                 return this.isSubtype(AbstractRule, supertype) || this.isSubtype(AbstractType, supertype);
19189             }
19190             case TerminalRule: {
19191                 return this.isSubtype(AbstractRule, supertype);
19192             }
19193             default: {
19194                 return false;
19195             }
19196         }
19197     }
19198     getReferenceType(refInfo) {
19199         const referenceId = `${refInfo.container.$type}:${refInfo.property}`;
19200         switch (referenceId) {
19201             case 'Action:type':
19202             case 'CrossReference:type':
19203             case 'Interface:superTypes':
19204             case 'ParserRule:returnType':
19205             case 'SimpleType:typeRef': {
19206                 return AbstractType;
19207             }
19208             case 'Grammar:hiddenTokens':
19209             case 'ParserRule:hiddenTokens':
19210             case 'RuleCall:rule': {
19211                 return AbstractRule;
19212             }
19213             case 'Grammar:usedGrammars': {
19214                 return Grammar;
19215             }
19216             case 'NamedArgument:parameter':
19217             case 'ParameterReference:parameter': {
19218                 return Parameter;
19219             }
19220             case 'TerminalRuleCall:rule': {
19221                 return TerminalRule;
19222             }
19223             default: {
19224                 throw new Error(`${referenceId} is not a valid reference id.`);
19225             }
19226         }
19227     }
19228     getTypeMetaData(type) {
19229         switch (type) {
19230             case AbstractElement: {
19231                 return {
19232                     name: AbstractElement,
19233                     properties: [
19234                         { name: 'cardinality' },
19235                         { name: 'lookahead' }
19236                     ]
19237                 };
19238             }
19239             case ArrayLiteral: {
19240                 return {
19241                     name: ArrayLiteral,
19242                     properties: [
19243                         { name: 'elements', defaultValue: [] }
19244                     ]
19245                 };
19246             }
19247             case ArrayType: {
19248                 return {
19249                     name: ArrayType,
19250                     properties: [
19251                         { name: 'elementType' }
19252                     ]
19253                 };
19254             }
19255             case BooleanLiteral: {
19256                 return {
19257                     name: BooleanLiteral,
19258                     properties: [
19259                         { name: 'true', defaultValue: false }
19260                     ]
19261                 };
19262             }
19263             case Conjunction: {
19264                 return {
19265                     name: Conjunction,
19266                     properties: [
19267                         { name: 'left' },
19268                         { name: 'right' }
19269                     ]
19270                 };
19271             }
19272             case Disjunction: {
19273                 return {
19274                     name: Disjunction,
19275                     properties: [
19276                         { name: 'left' },
19277                         { name: 'right' }
19278                     ]
19279                 };
19280             }
19281             case Grammar: {
19282                 return {
19283                     name: Grammar,
19284                     properties: [
19285                         { name: 'definesHiddenTokens', defaultValue: false },
19286                         { name: 'hiddenTokens', defaultValue: [] },
19287                         { name: 'imports', defaultValue: [] },
19288                         { name: 'interfaces', defaultValue: [] },
19289                         { name: 'isDeclared', defaultValue: false },
19290                         { name: 'name' },
19291                         { name: 'rules', defaultValue: [] },
19292                         { name: 'types', defaultValue: [] },
19293                         { name: 'usedGrammars', defaultValue: [] }
19294                     ]
19295                 };
19296             }
19297             case GrammarImport: {
19298                 return {
19299                     name: GrammarImport,
19300                     properties: [
19301                         { name: 'path' }
19302                     ]
19303                 };
19304             }
19305             case InferredType: {
19306                 return {
19307                     name: InferredType,
19308                     properties: [
19309                         { name: 'name' }
19310                     ]
19311                 };
19312             }
19313             case Interface: {
19314                 return {
19315                     name: Interface,
19316                     properties: [
19317                         { name: 'attributes', defaultValue: [] },
19318                         { name: 'name' },
19319                         { name: 'superTypes', defaultValue: [] }
19320                     ]
19321                 };
19322             }
19323             case NamedArgument: {
19324                 return {
19325                     name: NamedArgument,
19326                     properties: [
19327                         { name: 'calledByName', defaultValue: false },
19328                         { name: 'parameter' },
19329                         { name: 'value' }
19330                     ]
19331                 };
19332             }
19333             case Negation: {
19334                 return {
19335                     name: Negation,
19336                     properties: [
19337                         { name: 'value' }
19338                     ]
19339                 };
19340             }
19341             case NumberLiteral: {
19342                 return {
19343                     name: NumberLiteral,
19344                     properties: [
19345                         { name: 'value' }
19346                     ]
19347                 };
19348             }
19349             case Parameter: {
19350                 return {
19351                     name: Parameter,
19352                     properties: [
19353                         { name: 'name' }
19354                     ]
19355                 };
19356             }
19357             case ParameterReference: {
19358                 return {
19359                     name: ParameterReference,
19360                     properties: [
19361                         { name: 'parameter' }
19362                     ]
19363                 };
19364             }
19365             case ParserRule: {
19366                 return {
19367                     name: ParserRule,
19368                     properties: [
19369                         { name: 'dataType' },
19370                         { name: 'definesHiddenTokens', defaultValue: false },
19371                         { name: 'definition' },
19372                         { name: 'entry', defaultValue: false },
19373                         { name: 'fragment', defaultValue: false },
19374                         { name: 'hiddenTokens', defaultValue: [] },
19375                         { name: 'inferredType' },
19376                         { name: 'name' },
19377                         { name: 'parameters', defaultValue: [] },
19378                         { name: 'returnType' },
19379                         { name: 'wildcard', defaultValue: false }
19380                     ]
19381                 };
19382             }
19383             case ReferenceType: {
19384                 return {
19385                     name: ReferenceType,
19386                     properties: [
19387                         { name: 'referenceType' }
19388                     ]
19389                 };
19390             }
19391             case ReturnType: {
19392                 return {
19393                     name: ReturnType,
19394                     properties: [
19395                         { name: 'name' }
19396                     ]
19397                 };
19398             }
19399             case SimpleType: {
19400                 return {
19401                     name: SimpleType,
19402                     properties: [
19403                         { name: 'primitiveType' },
19404                         { name: 'stringType' },
19405                         { name: 'typeRef' }
19406                     ]
19407                 };
19408             }
19409             case StringLiteral: {
19410                 return {
19411                     name: StringLiteral,
19412                     properties: [
19413                         { name: 'value' }
19414                     ]
19415                 };
19416             }
19417             case TerminalRule: {
19418                 return {
19419                     name: TerminalRule,
19420                     properties: [
19421                         { name: 'definition' },
19422                         { name: 'fragment', defaultValue: false },
19423                         { name: 'hidden', defaultValue: false },
19424                         { name: 'name' },
19425                         { name: 'type' }
19426                     ]
19427                 };
19428             }
19429             case Type: {
19430                 return {
19431                     name: Type,
19432                     properties: [
19433                         { name: 'name' },
19434                         { name: 'type' }
19435                     ]
19436                 };
19437             }
19438             case TypeAttribute: {
19439                 return {
19440                     name: TypeAttribute,
19441                     properties: [
19442                         { name: 'defaultValue' },
19443                         { name: 'isOptional', defaultValue: false },
19444                         { name: 'name' },
19445                         { name: 'type' }
19446                     ]
19447                 };
19448             }
19449             case UnionType: {
19450                 return {
19451                     name: UnionType,
19452                     properties: [
19453                         { name: 'types', defaultValue: [] }
19454                     ]
19455                 };
19456             }
19457             case Action: {
19458                 return {
19459                     name: Action,
19460                     properties: [
19461                         { name: 'cardinality' },
19462                         { name: 'feature' },
19463                         { name: 'inferredType' },
19464                         { name: 'lookahead' },
19465                         { name: 'operator' },
19466                         { name: 'type' }
19467                     ]
19468                 };
19469             }
19470             case Alternatives: {
19471                 return {
19472                     name: Alternatives,
19473                     properties: [
19474                         { name: 'cardinality' },
19475                         { name: 'elements', defaultValue: [] },
19476                         { name: 'lookahead' }
19477                     ]
19478                 };
19479             }
19480             case Assignment: {
19481                 return {
19482                     name: Assignment,
19483                     properties: [
19484                         { name: 'cardinality' },
19485                         { name: 'feature' },
19486                         { name: 'lookahead' },
19487                         { name: 'operator' },
19488                         { name: 'terminal' }
19489                     ]
19490                 };
19491             }
19492             case CharacterRange: {
19493                 return {
19494                     name: CharacterRange,
19495                     properties: [
19496                         { name: 'cardinality' },
19497                         { name: 'left' },
19498                         { name: 'lookahead' },
19499                         { name: 'right' }
19500                     ]
19501                 };
19502             }
19503             case CrossReference: {
19504                 return {
19505                     name: CrossReference,
19506                     properties: [
19507                         { name: 'cardinality' },
19508                         { name: 'deprecatedSyntax', defaultValue: false },
19509                         { name: 'lookahead' },
19510                         { name: 'terminal' },
19511                         { name: 'type' }
19512                     ]
19513                 };
19514             }
19515             case EndOfFile: {
19516                 return {
19517                     name: EndOfFile,
19518                     properties: [
19519                         { name: 'cardinality' },
19520                         { name: 'lookahead' }
19521                     ]
19522                 };
19523             }
19524             case Group: {
19525                 return {
19526                     name: Group,
19527                     properties: [
19528                         { name: 'cardinality' },
19529                         { name: 'elements', defaultValue: [] },
19530                         { name: 'guardCondition' },
19531                         { name: 'lookahead' }
19532                     ]
19533                 };
19534             }
19535             case Keyword: {
19536                 return {
19537                     name: Keyword,
19538                     properties: [
19539                         { name: 'cardinality' },
19540                         { name: 'lookahead' },
19541                         { name: 'value' }
19542                     ]
19543                 };
19544             }
19545             case NegatedToken: {
19546                 return {
19547                     name: NegatedToken,
19548                     properties: [
19549                         { name: 'cardinality' },
19550                         { name: 'lookahead' },
19551                         { name: 'terminal' }
19552                     ]
19553                 };
19554             }
19555             case RegexToken: {
19556                 return {
19557                     name: RegexToken,
19558                     properties: [
19559                         { name: 'cardinality' },
19560                         { name: 'lookahead' },
19561                         { name: 'regex' }
19562                     ]
19563                 };
19564             }
19565             case RuleCall: {
19566                 return {
19567                     name: RuleCall,
19568                     properties: [
19569                         { name: 'arguments', defaultValue: [] },
19570                         { name: 'cardinality' },
19571                         { name: 'lookahead' },
19572                         { name: 'rule' }
19573                     ]
19574                 };
19575             }
19576             case TerminalAlternatives: {
19577                 return {
19578                     name: TerminalAlternatives,
19579                     properties: [
19580                         { name: 'cardinality' },
19581                         { name: 'elements', defaultValue: [] },
19582                         { name: 'lookahead' }
19583                     ]
19584                 };
19585             }
19586             case TerminalGroup: {
19587                 return {
19588                     name: TerminalGroup,
19589                     properties: [
19590                         { name: 'cardinality' },
19591                         { name: 'elements', defaultValue: [] },
19592                         { name: 'lookahead' }
19593                     ]
19594                 };
19595             }
19596             case TerminalRuleCall: {
19597                 return {
19598                     name: TerminalRuleCall,
19599                     properties: [
19600                         { name: 'cardinality' },
19601                         { name: 'lookahead' },
19602                         { name: 'rule' }
19603                     ]
19604                 };
19605             }
19606             case UnorderedGroup: {
19607                 return {
19608                     name: UnorderedGroup,
19609                     properties: [
19610                         { name: 'cardinality' },
19611                         { name: 'elements', defaultValue: [] },
19612                         { name: 'lookahead' }
19613                     ]
19614                 };
19615             }
19616             case UntilToken: {
19617                 return {
19618                     name: UntilToken,
19619                     properties: [
19620                         { name: 'cardinality' },
19621                         { name: 'lookahead' },
19622                         { name: 'terminal' }
19623                     ]
19624                 };
19625             }
19626             case Wildcard: {
19627                 return {
19628                     name: Wildcard,
19629                     properties: [
19630                         { name: 'cardinality' },
19631                         { name: 'lookahead' }
19632                     ]
19633                 };
19634             }
19635             default: {
19636                 return {
19637                     name: type,
19638                     properties: []
19639                 };
19640             }
19641         }
19642     }
19643 }
19644 const reflection = new LangiumGrammarAstReflection();
19645 //# sourceMappingURL=ast.js.map
19646 
19647 /***/ }),
19648 
19649 /***/ 35481:
19650 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19651 
19652 "use strict";
19653 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
19654 /* harmony export */   P: () => (/* binding */ DefaultTokenBuilder)
19655 /* harmony export */ });
19656 /* harmony import */ var chevrotain__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34326);
19657 /* harmony import */ var _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34905);
19658 /* harmony import */ var _utils_ast_utils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(74857);
19659 /* harmony import */ var _utils_grammar_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30447);
19660 /* harmony import */ var _utils_regexp_utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43078);
19661 /* harmony import */ var _utils_stream_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99293);
19662 /******************************************************************************
19663  * Copyright 2021 TypeFox GmbH
19664  * This program and the accompanying materials are made available under the
19665  * terms of the MIT License, which is available in the project root.
19666  ******************************************************************************/
19667 
19668 
19669 
19670 
19671 
19672 
19673 class DefaultTokenBuilder {
19674     constructor() {
19675         /**
19676          * The list of diagnostics stored during the lexing process of a single text.
19677          */
19678         this.diagnostics = [];
19679     }
19680     buildTokens(grammar, options) {
19681         const reachableRules = (0,_utils_stream_js__WEBPACK_IMPORTED_MODULE_1__/* .stream */ .Vw)((0,_utils_grammar_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getAllReachableRules */ .VD)(grammar, false));
19682         const terminalTokens = this.buildTerminalTokens(reachableRules);
19683         const tokens = this.buildKeywordTokens(reachableRules, terminalTokens, options);
19684         terminalTokens.forEach(terminalToken => {
19685             const pattern = terminalToken.PATTERN;
19686             if (typeof pattern === 'object' && pattern && 'test' in pattern && (0,_utils_regexp_utils_js__WEBPACK_IMPORTED_MODULE_3__/* .isWhitespace */ .cb)(pattern)) {
19687                 tokens.unshift(terminalToken);
19688             }
19689             else {
19690                 tokens.push(terminalToken);
19691             }
19692         });
19693         // We don't need to add the EOF token explicitly.
19694         // It is automatically available at the end of the token stream.
19695         return tokens;
19696     }
19697     // eslint-disable-next-line @typescript-eslint/no-unused-vars
19698     flushLexingReport(text) {
19699         return { diagnostics: this.popDiagnostics() };
19700     }
19701     popDiagnostics() {
19702         const diagnostics = [...this.diagnostics];
19703         this.diagnostics = [];
19704         return diagnostics;
19705     }
19706     buildTerminalTokens(rules) {
19707         return rules.filter(_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_4__/* .isTerminalRule */ .MS).filter(e => !e.fragment)
19708             .map(terminal => this.buildTerminalToken(terminal)).toArray();
19709     }
19710     buildTerminalToken(terminal) {
19711         const regex = (0,_utils_grammar_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .terminalRegex */ .s1)(terminal);
19712         const pattern = this.requiresCustomPattern(regex) ? this.regexPatternFunction(regex) : regex;
19713         const tokenType = {
19714             name: terminal.name,
19715             PATTERN: pattern,
19716         };
19717         if (typeof pattern === 'function') {
19718             tokenType.LINE_BREAKS = true;
19719         }
19720         if (terminal.hidden) {
19721             // Only skip tokens that are able to accept whitespace
19722             tokenType.GROUP = (0,_utils_regexp_utils_js__WEBPACK_IMPORTED_MODULE_3__/* .isWhitespace */ .cb)(regex) ? chevrotain__WEBPACK_IMPORTED_MODULE_0__/* .Lexer */ .hW.SKIPPED : 'hidden';
19723         }
19724         return tokenType;
19725     }
19726     requiresCustomPattern(regex) {
19727         if (regex.flags.includes('u') || regex.flags.includes('s')) {
19728             // Unicode and dotall regexes are not supported by Chevrotain.
19729             return true;
19730         }
19731         else if (regex.source.includes('?<=') || regex.source.includes('?<!')) {
19732             // Negative and positive lookbehind are not supported by Chevrotain yet.
19733             return true;
19734         }
19735         else {
19736             return false;
19737         }
19738     }
19739     regexPatternFunction(regex) {
19740         const stickyRegex = new RegExp(regex, regex.flags + 'y');
19741         return (text, offset) => {
19742             stickyRegex.lastIndex = offset;
19743             const execResult = stickyRegex.exec(text);
19744             return execResult;
19745         };
19746     }
19747     buildKeywordTokens(rules, terminalTokens, options) {
19748         return rules
19749             // We filter by parser rules, since keywords in terminal rules get transformed into regex and are not actual tokens
19750             .filter(_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_4__/* .isParserRule */ .F9)
19751             .flatMap(rule => (0,_utils_ast_utils_js__WEBPACK_IMPORTED_MODULE_5__/* .streamAllContents */ .VY)(rule).filter(_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_4__/* .isKeyword */ .p1))
19752             .distinct(e => e.value).toArray()
19753             // Sort keywords by descending length
19754             .sort((a, b) => b.value.length - a.value.length)
19755             .map(keyword => this.buildKeywordToken(keyword, terminalTokens, Boolean(options === null || options === void 0 ? void 0 : options.caseInsensitive)));
19756     }
19757     buildKeywordToken(keyword, terminalTokens, caseInsensitive) {
19758         const keywordPattern = this.buildKeywordPattern(keyword, caseInsensitive);
19759         const tokenType = {
19760             name: keyword.value,
19761             PATTERN: keywordPattern,
19762             LONGER_ALT: this.findLongerAlt(keyword, terminalTokens)
19763         };
19764         if (typeof keywordPattern === 'function') {
19765             tokenType.LINE_BREAKS = true;
19766         }
19767         return tokenType;
19768     }
19769     buildKeywordPattern(keyword, caseInsensitive) {
19770         return caseInsensitive ?
19771             new RegExp((0,_utils_regexp_utils_js__WEBPACK_IMPORTED_MODULE_3__/* .getCaseInsensitivePattern */ .cp)(keyword.value)) :
19772             keyword.value;
19773     }
19774     findLongerAlt(keyword, terminalTokens) {
19775         return terminalTokens.reduce((longerAlts, token) => {
19776             const pattern = token === null || token === void 0 ? void 0 : token.PATTERN;
19777             if ((pattern === null || pattern === void 0 ? void 0 : pattern.source) && (0,_utils_regexp_utils_js__WEBPACK_IMPORTED_MODULE_3__/* .partialMatches */ .XC)('^' + pattern.source + '$', keyword.value)) {
19778                 longerAlts.push(token);
19779             }
19780             return longerAlts;
19781         }, []);
19782     }
19783 }
19784 //# sourceMappingURL=token-builder.js.map
19785 
19786 /***/ }),
19787 
19788 /***/ 46174:
19789 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19790 
19791 "use strict";
19792 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
19793 /* harmony export */   t: () => (/* binding */ DefaultValueConverter)
19794 /* harmony export */ });
19795 /* unused harmony export ValueConverter */
19796 /* harmony import */ var _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34905);
19797 /* harmony import */ var _utils_grammar_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(30447);
19798 /******************************************************************************
19799  * Copyright 2021 TypeFox GmbH
19800  * This program and the accompanying materials are made available under the
19801  * terms of the MIT License, which is available in the project root.
19802  ******************************************************************************/
19803 
19804 
19805 class DefaultValueConverter {
19806     convert(input, cstNode) {
19807         let feature = cstNode.grammarSource;
19808         if ((0,_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isCrossReference */ .Ki)(feature)) {
19809             feature = (0,_utils_grammar_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getCrossReferenceTerminal */ .eN)(feature);
19810         }
19811         if ((0,_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isRuleCall */ .t3)(feature)) {
19812             const rule = feature.rule.ref;
19813             if (!rule) {
19814                 throw new Error('This cst node was not parsed by a rule.');
19815             }
19816             return this.runConverter(rule, input, cstNode);
19817         }
19818         return input;
19819     }
19820     // eslint-disable-next-line @typescript-eslint/no-unused-vars
19821     runConverter(rule, input, cstNode) {
19822         var _a;
19823         switch (rule.name.toUpperCase()) {
19824             case 'INT': return ValueConverter.convertInt(input);
19825             case 'STRING': return ValueConverter.convertString(input);
19826             case 'ID': return ValueConverter.convertID(input);
19827         }
19828         switch ((_a = (0,_utils_grammar_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getRuleType */ .mJ)(rule)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) {
19829             case 'number': return ValueConverter.convertNumber(input);
19830             case 'boolean': return ValueConverter.convertBoolean(input);
19831             case 'bigint': return ValueConverter.convertBigint(input);
19832             case 'date': return ValueConverter.convertDate(input);
19833             default: return input;
19834         }
19835     }
19836 }
19837 var ValueConverter;
19838 (function (ValueConverter) {
19839     function convertString(input) {
19840         let result = '';
19841         for (let i = 1; i < input.length - 1; i++) {
19842             const c = input.charAt(i);
19843             if (c === '\\') {
19844                 const c1 = input.charAt(++i);
19845                 result += convertEscapeCharacter(c1);
19846             }
19847             else {
19848                 result += c;
19849             }
19850         }
19851         return result;
19852     }
19853     ValueConverter.convertString = convertString;
19854     function convertEscapeCharacter(char) {
19855         switch (char) {
19856             case 'b': return '\b';
19857             case 'f': return '\f';
19858             case 'n': return '\n';
19859             case 'r': return '\r';
19860             case 't': return '\t';
19861             case 'v': return '\v';
19862             case '0': return '\0';
19863             default: return char;
19864         }
19865     }
19866     function convertID(input) {
19867         if (input.charAt(0) === '^') {
19868             return input.substring(1);
19869         }
19870         else {
19871             return input;
19872         }
19873     }
19874     ValueConverter.convertID = convertID;
19875     function convertInt(input) {
19876         return parseInt(input);
19877     }
19878     ValueConverter.convertInt = convertInt;
19879     function convertBigint(input) {
19880         return BigInt(input);
19881     }
19882     ValueConverter.convertBigint = convertBigint;
19883     function convertDate(input) {
19884         return new Date(input);
19885     }
19886     ValueConverter.convertDate = convertDate;
19887     function convertNumber(input) {
19888         return Number(input);
19889     }
19890     ValueConverter.convertNumber = convertNumber;
19891     function convertBoolean(input) {
19892         return input.toLowerCase() === 'true';
19893     }
19894     ValueConverter.convertBoolean = convertBoolean;
19895 })(ValueConverter || (ValueConverter = {}));
19896 //# sourceMappingURL=value-converter.js.map
19897 
19898 /***/ }),
19899 
19900 /***/ 91303:
19901 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19902 
19903 "use strict";
19904 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
19905 /* harmony export */   $v: () => (/* binding */ AbstractAstReflection),
19906 /* harmony export */   SI: () => (/* binding */ isAstNodeDescription),
19907 /* harmony export */   U8: () => (/* binding */ isRootCstNode),
19908 /* harmony export */   Yk: () => (/* binding */ isReference),
19909 /* harmony export */   al: () => (/* binding */ isCompositeCstNode),
19910 /* harmony export */   dm: () => (/* binding */ isLeafCstNode),
19911 /* harmony export */   et: () => (/* binding */ isLinkingError),
19912 /* harmony export */   xA: () => (/* binding */ isAstNode)
19913 /* harmony export */ });
19914 /******************************************************************************
19915  * Copyright 2021 TypeFox GmbH
19916  * This program and the accompanying materials are made available under the
19917  * terms of the MIT License, which is available in the project root.
19918  ******************************************************************************/
19919 function isAstNode(obj) {
19920     return typeof obj === 'object' && obj !== null && typeof obj.$type === 'string';
19921 }
19922 function isReference(obj) {
19923     return typeof obj === 'object' && obj !== null && typeof obj.$refText === 'string';
19924 }
19925 function isAstNodeDescription(obj) {
19926     return typeof obj === 'object' && obj !== null
19927         && typeof obj.name === 'string'
19928         && typeof obj.type === 'string'
19929         && typeof obj.path === 'string';
19930 }
19931 function isLinkingError(obj) {
19932     return typeof obj === 'object' && obj !== null
19933         && isAstNode(obj.container)
19934         && isReference(obj.reference)
19935         && typeof obj.message === 'string';
19936 }
19937 /**
19938  * An abstract implementation of the {@link AstReflection} interface.
19939  * Serves to cache subtype computation results to improve performance throughout different parts of Langium.
19940  */
19941 class AbstractAstReflection {
19942     constructor() {
19943         this.subtypes = {};
19944         this.allSubtypes = {};
19945     }
19946     isInstance(node, type) {
19947         return isAstNode(node) && this.isSubtype(node.$type, type);
19948     }
19949     isSubtype(subtype, supertype) {
19950         if (subtype === supertype) {
19951             return true;
19952         }
19953         let nested = this.subtypes[subtype];
19954         if (!nested) {
19955             nested = this.subtypes[subtype] = {};
19956         }
19957         const existing = nested[supertype];
19958         if (existing !== undefined) {
19959             return existing;
19960         }
19961         else {
19962             const result = this.computeIsSubtype(subtype, supertype);
19963             nested[supertype] = result;
19964             return result;
19965         }
19966     }
19967     getAllSubTypes(type) {
19968         const existing = this.allSubtypes[type];
19969         if (existing) {
19970             return existing;
19971         }
19972         else {
19973             const allTypes = this.getAllTypes();
19974             const types = [];
19975             for (const possibleSubType of allTypes) {
19976                 if (this.isSubtype(possibleSubType, type)) {
19977                     types.push(possibleSubType);
19978                 }
19979             }
19980             this.allSubtypes[type] = types;
19981             return types;
19982         }
19983     }
19984 }
19985 function isCompositeCstNode(node) {
19986     return typeof node === 'object' && node !== null && Array.isArray(node.content);
19987 }
19988 function isLeafCstNode(node) {
19989     return typeof node === 'object' && node !== null && typeof node.tokenType === 'object';
19990 }
19991 function isRootCstNode(node) {
19992     return isCompositeCstNode(node) && typeof node.fullText === 'string';
19993 }
19994 //# sourceMappingURL=syntax-tree.js.map
19995 
19996 /***/ }),
19997 
19998 /***/ 74857:
19999 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20000 
20001 "use strict";
20002 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
20003 /* harmony export */   E$: () => (/* binding */ findRootNode),
20004 /* harmony export */   Me: () => (/* binding */ getDocument),
20005 /* harmony export */   VY: () => (/* binding */ streamAllContents),
20006 /* harmony export */   V_: () => (/* binding */ getContainerOfType),
20007 /* harmony export */   Zc: () => (/* binding */ streamAst),
20008 /* harmony export */   a1: () => (/* binding */ assignMandatoryProperties),
20009 /* harmony export */   b2: () => (/* binding */ linkContentToContainer),
20010 /* harmony export */   fy: () => (/* binding */ streamReferences),
20011 /* harmony export */   sx: () => (/* binding */ streamContents)
20012 /* harmony export */ });
20013 /* unused harmony exports hasContainerOfType, findLocalReferences, copyAstNode */
20014 /* harmony import */ var _syntax_tree_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91303);
20015 /* harmony import */ var _stream_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99293);
20016 /* harmony import */ var _cst_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13871);
20017 /******************************************************************************
20018  * Copyright 2021 TypeFox GmbH
20019  * This program and the accompanying materials are made available under the
20020  * terms of the MIT License, which is available in the project root.
20021  ******************************************************************************/
20022 
20023 
20024 
20025 /**
20026  * Link the `$container` and other related properties of every AST node that is directly contained
20027  * in the given `node`.
20028  */
20029 function linkContentToContainer(node) {
20030     for (const [name, value] of Object.entries(node)) {
20031         if (!name.startsWith('$')) {
20032             if (Array.isArray(value)) {
20033                 value.forEach((item, index) => {
20034                     if ((0,_syntax_tree_js__WEBPACK_IMPORTED_MODULE_0__/* .isAstNode */ .xA)(item)) {
20035                         item.$container = node;
20036                         item.$containerProperty = name;
20037                         item.$containerIndex = index;
20038                     }
20039                 });
20040             }
20041             else if ((0,_syntax_tree_js__WEBPACK_IMPORTED_MODULE_0__/* .isAstNode */ .xA)(value)) {
20042                 value.$container = node;
20043                 value.$containerProperty = name;
20044             }
20045         }
20046     }
20047 }
20048 /**
20049  * Walk along the hierarchy of containers from the given AST node to the root and return the first
20050  * node that matches the type predicate. If the start node itself matches, it is returned.
20051  * If no container matches, `undefined` is returned.
20052  */
20053 function getContainerOfType(node, typePredicate) {
20054     let item = node;
20055     while (item) {
20056         if (typePredicate(item)) {
20057             return item;
20058         }
20059         item = item.$container;
20060     }
20061     return undefined;
20062 }
20063 /**
20064  * Walk along the hierarchy of containers from the given AST node to the root and check for existence
20065  * of a container that matches the given predicate. The start node is included in the checks.
20066  */
20067 function hasContainerOfType(node, predicate) {
20068     let item = node;
20069     while (item) {
20070         if (predicate(item)) {
20071             return true;
20072         }
20073         item = item.$container;
20074     }
20075     return false;
20076 }
20077 /**
20078  * Retrieve the document in which the given AST node is contained. A reference to the document is
20079  * usually held by the root node of the AST.
20080  *
20081  * @throws an error if the node is not contained in a document.
20082  */
20083 function getDocument(node) {
20084     const rootNode = findRootNode(node);
20085     const result = rootNode.$document;
20086     if (!result) {
20087         throw new Error('AST node has no document.');
20088     }
20089     return result;
20090 }
20091 /**
20092  * Returns the root node of the given AST node by following the `$container` references.
20093  */
20094 function findRootNode(node) {
20095     while (node.$container) {
20096         node = node.$container;
20097     }
20098     return node;
20099 }
20100 /**
20101  * Create a stream of all AST nodes that are directly contained in the given node. This includes
20102  * single-valued as well as multi-valued (array) properties.
20103  */
20104 function streamContents(node, options) {
20105     if (!node) {
20106         throw new Error('Node must be an AstNode.');
20107     }
20108     const range = options === null || options === void 0 ? void 0 : options.range;
20109     return new _stream_js__WEBPACK_IMPORTED_MODULE_1__/* .StreamImpl */ .i(() => ({
20110         keys: Object.keys(node),
20111         keyIndex: 0,
20112         arrayIndex: 0
20113     }), state => {
20114         while (state.keyIndex < state.keys.length) {
20115             const property = state.keys[state.keyIndex];
20116             if (!property.startsWith('$')) {
20117                 const value = node[property];
20118                 if ((0,_syntax_tree_js__WEBPACK_IMPORTED_MODULE_0__/* .isAstNode */ .xA)(value)) {
20119                     state.keyIndex++;
20120                     if (isAstNodeInRange(value, range)) {
20121                         return { done: false, value };
20122                     }
20123                 }
20124                 else if (Array.isArray(value)) {
20125                     while (state.arrayIndex < value.length) {
20126                         const index = state.arrayIndex++;
20127                         const element = value[index];
20128                         if ((0,_syntax_tree_js__WEBPACK_IMPORTED_MODULE_0__/* .isAstNode */ .xA)(element) && isAstNodeInRange(element, range)) {
20129                             return { done: false, value: element };
20130                         }
20131                     }
20132                     state.arrayIndex = 0;
20133                 }
20134             }
20135             state.keyIndex++;
20136         }
20137         return _stream_js__WEBPACK_IMPORTED_MODULE_1__/* .DONE_RESULT */ .Ry;
20138     });
20139 }
20140 /**
20141  * Create a stream of all AST nodes that are directly and indirectly contained in the given root node.
20142  * This does not include the root node itself.
20143  */
20144 function streamAllContents(root, options) {
20145     if (!root) {
20146         throw new Error('Root node must be an AstNode.');
20147     }
20148     return new _stream_js__WEBPACK_IMPORTED_MODULE_1__/* .TreeStreamImpl */ .i8(root, node => streamContents(node, options));
20149 }
20150 /**
20151  * Create a stream of all AST nodes that are directly and indirectly contained in the given root node,
20152  * including the root node itself.
20153  */
20154 function streamAst(root, options) {
20155     if (!root) {
20156         throw new Error('Root node must be an AstNode.');
20157     }
20158     else if ((options === null || options === void 0 ? void 0 : options.range) && !isAstNodeInRange(root, options.range)) {
20159         // Return an empty stream if the root node isn't in range
20160         return new _stream_js__WEBPACK_IMPORTED_MODULE_1__/* .TreeStreamImpl */ .i8(root, () => []);
20161     }
20162     return new _stream_js__WEBPACK_IMPORTED_MODULE_1__/* .TreeStreamImpl */ .i8(root, node => streamContents(node, options), { includeRoot: true });
20163 }
20164 function isAstNodeInRange(astNode, range) {
20165     var _a;
20166     if (!range) {
20167         return true;
20168     }
20169     const nodeRange = (_a = astNode.$cstNode) === null || _a === void 0 ? void 0 : _a.range;
20170     if (!nodeRange) {
20171         return false;
20172     }
20173     return (0,_cst_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .inRange */ .Z2)(nodeRange, range);
20174 }
20175 /**
20176  * Create a stream of all cross-references that are held by the given AST node. This includes
20177  * single-valued as well as multi-valued (array) properties.
20178  */
20179 function streamReferences(node) {
20180     return new _stream_js__WEBPACK_IMPORTED_MODULE_1__/* .StreamImpl */ .i(() => ({
20181         keys: Object.keys(node),
20182         keyIndex: 0,
20183         arrayIndex: 0
20184     }), state => {
20185         while (state.keyIndex < state.keys.length) {
20186             const property = state.keys[state.keyIndex];
20187             if (!property.startsWith('$')) {
20188                 const value = node[property];
20189                 if ((0,_syntax_tree_js__WEBPACK_IMPORTED_MODULE_0__/* .isReference */ .Yk)(value)) {
20190                     state.keyIndex++;
20191                     return { done: false, value: { reference: value, container: node, property } };
20192                 }
20193                 else if (Array.isArray(value)) {
20194                     while (state.arrayIndex < value.length) {
20195                         const index = state.arrayIndex++;
20196                         const element = value[index];
20197                         if ((0,_syntax_tree_js__WEBPACK_IMPORTED_MODULE_0__/* .isReference */ .Yk)(element)) {
20198                             return { done: false, value: { reference: element, container: node, property, index } };
20199                         }
20200                     }
20201                     state.arrayIndex = 0;
20202                 }
20203             }
20204             state.keyIndex++;
20205         }
20206         return _stream_js__WEBPACK_IMPORTED_MODULE_1__/* .DONE_RESULT */ .Ry;
20207     });
20208 }
20209 /**
20210  * Returns a Stream of references to the target node from the AstNode tree
20211  *
20212  * @param targetNode AstNode we are looking for
20213  * @param lookup AstNode where we search for references. If not provided, the root node of the document is used as the default value
20214  */
20215 function findLocalReferences(targetNode, lookup = getDocument(targetNode).parseResult.value) {
20216     const refs = [];
20217     streamAst(lookup).forEach(node => {
20218         streamReferences(node).forEach(refInfo => {
20219             if (refInfo.reference.ref === targetNode) {
20220                 refs.push(refInfo.reference);
20221             }
20222         });
20223     });
20224     return stream(refs);
20225 }
20226 /**
20227  * Assigns all mandatory AST properties to the specified node.
20228  *
20229  * @param reflection Reflection object used to gather mandatory properties for the node.
20230  * @param node Specified node is modified in place and properties are directly assigned.
20231  */
20232 function assignMandatoryProperties(reflection, node) {
20233     const typeMetaData = reflection.getTypeMetaData(node.$type);
20234     const genericNode = node;
20235     for (const property of typeMetaData.properties) {
20236         // Only set the value if the property is not already set and if it has a default value
20237         if (property.defaultValue !== undefined && genericNode[property.name] === undefined) {
20238             genericNode[property.name] = copyDefaultValue(property.defaultValue);
20239         }
20240     }
20241 }
20242 function copyDefaultValue(propertyType) {
20243     if (Array.isArray(propertyType)) {
20244         return [...propertyType.map(copyDefaultValue)];
20245     }
20246     else {
20247         return propertyType;
20248     }
20249 }
20250 /**
20251  * Creates a deep copy of the specified AST node.
20252  * The resulting copy will only contain semantically relevant information, such as the `$type` property and AST properties.
20253  *
20254  * References are copied without resolved cross reference. The specified function is used to rebuild them.
20255  */
20256 function copyAstNode(node, buildReference) {
20257     const copy = { $type: node.$type };
20258     for (const [name, value] of Object.entries(node)) {
20259         if (!name.startsWith('$')) {
20260             if (isAstNode(value)) {
20261                 copy[name] = copyAstNode(value, buildReference);
20262             }
20263             else if (isReference(value)) {
20264                 copy[name] = buildReference(copy, name, value.$refNode, value.$refText);
20265             }
20266             else if (Array.isArray(value)) {
20267                 const copiedArray = [];
20268                 for (const element of value) {
20269                     if (isAstNode(element)) {
20270                         copiedArray.push(copyAstNode(element, buildReference));
20271                     }
20272                     else if (isReference(element)) {
20273                         copiedArray.push(buildReference(copy, name, element.$refNode, element.$refText));
20274                     }
20275                     else {
20276                         copiedArray.push(element);
20277                     }
20278                 }
20279                 copy[name] = copiedArray;
20280             }
20281             else {
20282                 copy[name] = value;
20283             }
20284         }
20285     }
20286     linkContentToContainer(copy);
20287     return copy;
20288 }
20289 //# sourceMappingURL=ast-utils.js.map
20290 
20291 /***/ }),
20292 
20293 /***/ 13871:
20294 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20295 
20296 "use strict";
20297 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
20298 /* harmony export */   LK: () => (/* binding */ findCommentNode),
20299 /* harmony export */   OB: () => (/* binding */ isChildNode),
20300 /* harmony export */   Z2: () => (/* binding */ inRange),
20301 /* harmony export */   _t: () => (/* binding */ streamCst),
20302 /* harmony export */   sp: () => (/* binding */ tokenToRange),
20303 /* harmony export */   uz: () => (/* binding */ DefaultNameRegexp),
20304 /* harmony export */   yn: () => (/* binding */ toDocumentSegment)
20305 /* harmony export */ });
20306 /* unused harmony exports flattenCst, RangeComparison, compareRange, findDeclarationNodeAtOffset, isCommentNode, findLeafNodeAtOffset, findLeafNodeBeforeOffset, getPreviousNode, getNextNode, getStartlineNode, getInteriorNodes */
20307 /* harmony import */ var _syntax_tree_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(91303);
20308 /* harmony import */ var _stream_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(99293);
20309 /******************************************************************************
20310  * Copyright 2021 TypeFox GmbH
20311  * This program and the accompanying materials are made available under the
20312  * terms of the MIT License, which is available in the project root.
20313  ******************************************************************************/
20314 
20315 
20316 /**
20317  * Create a stream of all CST nodes that are directly and indirectly contained in the given root node,
20318  * including the root node itself.
20319  */
20320 function streamCst(node) {
20321     return new _stream_js__WEBPACK_IMPORTED_MODULE_0__/* .TreeStreamImpl */ .i8(node, element => {
20322         if ((0,_syntax_tree_js__WEBPACK_IMPORTED_MODULE_1__/* .isCompositeCstNode */ .al)(element)) {
20323             return element.content;
20324         }
20325         else {
20326             return [];
20327         }
20328     }, { includeRoot: true });
20329 }
20330 /**
20331  * Create a stream of all leaf nodes that are directly and indirectly contained in the given root node.
20332  */
20333 function flattenCst(node) {
20334     return streamCst(node).filter(isLeafCstNode);
20335 }
20336 /**
20337  * Determines whether the specified cst node is a child of the specified parent node.
20338  */
20339 function isChildNode(child, parent) {
20340     while (child.container) {
20341         child = child.container;
20342         if (child === parent) {
20343             return true;
20344         }
20345     }
20346     return false;
20347 }
20348 function tokenToRange(token) {
20349     // Chevrotain uses 1-based indices everywhere
20350     // So we subtract 1 from every value to align with the LSP
20351     return {
20352         start: {
20353             character: token.startColumn - 1,
20354             line: token.startLine - 1
20355         },
20356         end: {
20357             character: token.endColumn, // endColumn uses the correct index
20358             line: token.endLine - 1
20359         }
20360     };
20361 }
20362 function toDocumentSegment(node) {
20363     if (!node) {
20364         return undefined;
20365     }
20366     const { offset, end, range } = node;
20367     return {
20368         range,
20369         offset,
20370         end,
20371         length: end - offset
20372     };
20373 }
20374 var RangeComparison;
20375 (function (RangeComparison) {
20376     RangeComparison[RangeComparison["Before"] = 0] = "Before";
20377     RangeComparison[RangeComparison["After"] = 1] = "After";
20378     RangeComparison[RangeComparison["OverlapFront"] = 2] = "OverlapFront";
20379     RangeComparison[RangeComparison["OverlapBack"] = 3] = "OverlapBack";
20380     RangeComparison[RangeComparison["Inside"] = 4] = "Inside";
20381     RangeComparison[RangeComparison["Outside"] = 5] = "Outside";
20382 })(RangeComparison || (RangeComparison = {}));
20383 function compareRange(range, to) {
20384     if (range.end.line < to.start.line || (range.end.line === to.start.line && range.end.character <= to.start.character)) {
20385         return RangeComparison.Before;
20386     }
20387     else if (range.start.line > to.end.line || (range.start.line === to.end.line && range.start.character >= to.end.character)) {
20388         return RangeComparison.After;
20389     }
20390     const startInside = range.start.line > to.start.line || (range.start.line === to.start.line && range.start.character >= to.start.character);
20391     const endInside = range.end.line < to.end.line || (range.end.line === to.end.line && range.end.character <= to.end.character);
20392     if (startInside && endInside) {
20393         return RangeComparison.Inside;
20394     }
20395     else if (startInside) {
20396         return RangeComparison.OverlapBack;
20397     }
20398     else if (endInside) {
20399         return RangeComparison.OverlapFront;
20400     }
20401     else {
20402         return RangeComparison.Outside;
20403     }
20404 }
20405 function inRange(range, to) {
20406     const comparison = compareRange(range, to);
20407     return comparison > RangeComparison.After;
20408 }
20409 // The \p{L} regex matches any unicode letter character, i.e. characters from non-english alphabets
20410 // Together with \w it matches any kind of character which can commonly appear in IDs
20411 const DefaultNameRegexp = /^[\w\p{L}]$/u;
20412 /**
20413  * Performs `findLeafNodeAtOffset` with a minor difference: When encountering a character that matches the `nameRegexp` argument,
20414  * it will instead return the leaf node at the `offset - 1` position.
20415  *
20416  * For LSP services, users expect that the declaration of an element is available if the cursor is directly after the element.
20417  */
20418 function findDeclarationNodeAtOffset(cstNode, offset, nameRegexp = DefaultNameRegexp) {
20419     if (cstNode) {
20420         if (offset > 0) {
20421             const localOffset = offset - cstNode.offset;
20422             const textAtOffset = cstNode.text.charAt(localOffset);
20423             if (!nameRegexp.test(textAtOffset)) {
20424                 offset--;
20425             }
20426         }
20427         return findLeafNodeAtOffset(cstNode, offset);
20428     }
20429     return undefined;
20430 }
20431 function findCommentNode(cstNode, commentNames) {
20432     if (cstNode) {
20433         const previous = getPreviousNode(cstNode, true);
20434         if (previous && isCommentNode(previous, commentNames)) {
20435             return previous;
20436         }
20437         if ((0,_syntax_tree_js__WEBPACK_IMPORTED_MODULE_1__/* .isRootCstNode */ .U8)(cstNode)) {
20438             // Go from the first non-hidden node through all nodes in reverse order
20439             // We do this to find the comment node which directly precedes the root node
20440             const endIndex = cstNode.content.findIndex(e => !e.hidden);
20441             for (let i = endIndex - 1; i >= 0; i--) {
20442                 const child = cstNode.content[i];
20443                 if (isCommentNode(child, commentNames)) {
20444                     return child;
20445                 }
20446             }
20447         }
20448     }
20449     return undefined;
20450 }
20451 function isCommentNode(cstNode, commentNames) {
20452     return (0,_syntax_tree_js__WEBPACK_IMPORTED_MODULE_1__/* .isLeafCstNode */ .dm)(cstNode) && commentNames.includes(cstNode.tokenType.name);
20453 }
20454 /**
20455  * Finds the leaf CST node at the specified 0-based string offset.
20456  * Note that the given offset will be within the range of the returned leaf node.
20457  *
20458  * If the offset does not point to a CST node (but just white space), this method will return `undefined`.
20459  *
20460  * @param node The CST node to search through.
20461  * @param offset The specified offset.
20462  * @returns The CST node at the specified offset.
20463  */
20464 function findLeafNodeAtOffset(node, offset) {
20465     if (isLeafCstNode(node)) {
20466         return node;
20467     }
20468     else if (isCompositeCstNode(node)) {
20469         const searchResult = binarySearch(node, offset, false);
20470         if (searchResult) {
20471             return findLeafNodeAtOffset(searchResult, offset);
20472         }
20473     }
20474     return undefined;
20475 }
20476 /**
20477  * Finds the leaf CST node at the specified 0-based string offset.
20478  * If no CST node exists at the specified position, it will return the leaf node before it.
20479  *
20480  * If there is no leaf node before the specified offset, this method will return `undefined`.
20481  *
20482  * @param node The CST node to search through.
20483  * @param offset The specified offset.
20484  * @returns The CST node closest to the specified offset.
20485  */
20486 function findLeafNodeBeforeOffset(node, offset) {
20487     if (isLeafCstNode(node)) {
20488         return node;
20489     }
20490     else if (isCompositeCstNode(node)) {
20491         const searchResult = binarySearch(node, offset, true);
20492         if (searchResult) {
20493             return findLeafNodeBeforeOffset(searchResult, offset);
20494         }
20495     }
20496     return undefined;
20497 }
20498 function binarySearch(node, offset, closest) {
20499     let left = 0;
20500     let right = node.content.length - 1;
20501     let closestNode = undefined;
20502     while (left <= right) {
20503         const middle = Math.floor((left + right) / 2);
20504         const middleNode = node.content[middle];
20505         if (middleNode.offset <= offset && middleNode.end > offset) {
20506             // Found an exact match
20507             return middleNode;
20508         }
20509         if (middleNode.end <= offset) {
20510             // Update the closest node (less than offset) and move to the right half
20511             closestNode = closest ? middleNode : undefined;
20512             left = middle + 1;
20513         }
20514         else {
20515             // Move to the left half
20516             right = middle - 1;
20517         }
20518     }
20519     return closestNode;
20520 }
20521 function getPreviousNode(node, hidden = true) {
20522     while (node.container) {
20523         const parent = node.container;
20524         let index = parent.content.indexOf(node);
20525         while (index > 0) {
20526             index--;
20527             const previous = parent.content[index];
20528             if (hidden || !previous.hidden) {
20529                 return previous;
20530             }
20531         }
20532         node = parent;
20533     }
20534     return undefined;
20535 }
20536 function getNextNode(node, hidden = true) {
20537     while (node.container) {
20538         const parent = node.container;
20539         let index = parent.content.indexOf(node);
20540         const last = parent.content.length - 1;
20541         while (index < last) {
20542             index++;
20543             const next = parent.content[index];
20544             if (hidden || !next.hidden) {
20545                 return next;
20546             }
20547         }
20548         node = parent;
20549     }
20550     return undefined;
20551 }
20552 function getStartlineNode(node) {
20553     if (node.range.start.character === 0) {
20554         return node;
20555     }
20556     const line = node.range.start.line;
20557     let last = node;
20558     let index;
20559     while (node.container) {
20560         const parent = node.container;
20561         const selfIndex = index !== null && index !== void 0 ? index : parent.content.indexOf(node);
20562         if (selfIndex === 0) {
20563             node = parent;
20564             index = undefined;
20565         }
20566         else {
20567             index = selfIndex - 1;
20568             node = parent.content[index];
20569         }
20570         if (node.range.start.line !== line) {
20571             break;
20572         }
20573         last = node;
20574     }
20575     return last;
20576 }
20577 function getInteriorNodes(start, end) {
20578     const commonParent = getCommonParent(start, end);
20579     if (!commonParent) {
20580         return [];
20581     }
20582     return commonParent.parent.content.slice(commonParent.a + 1, commonParent.b);
20583 }
20584 function getCommonParent(a, b) {
20585     const aParents = getParentChain(a);
20586     const bParents = getParentChain(b);
20587     let current;
20588     for (let i = 0; i < aParents.length && i < bParents.length; i++) {
20589         const aParent = aParents[i];
20590         const bParent = bParents[i];
20591         if (aParent.parent === bParent.parent) {
20592             current = {
20593                 parent: aParent.parent,
20594                 a: aParent.index,
20595                 b: bParent.index
20596             };
20597         }
20598         else {
20599             break;
20600         }
20601     }
20602     return current;
20603 }
20604 function getParentChain(node) {
20605     const chain = [];
20606     while (node.container) {
20607         const parent = node.container;
20608         const index = parent.content.indexOf(node);
20609         chain.push({
20610             parent,
20611             index
20612         });
20613         node = parent;
20614     }
20615     return chain.reverse();
20616 }
20617 //# sourceMappingURL=cst-utils.js.map
20618 
20619 /***/ }),
20620 
20621 /***/ 45209:
20622 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20623 
20624 "use strict";
20625 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
20626 /* harmony export */   U: () => (/* binding */ assertUnreachable),
20627 /* harmony export */   h: () => (/* binding */ ErrorWithLocation)
20628 /* harmony export */ });
20629 /******************************************************************************
20630  * Copyright 2021 TypeFox GmbH
20631  * This program and the accompanying materials are made available under the
20632  * terms of the MIT License, which is available in the project root.
20633  ******************************************************************************/
20634 class ErrorWithLocation extends Error {
20635     constructor(node, message) {
20636         super(node ? `${message} at ${node.range.start.line}:${node.range.start.character}` : message);
20637     }
20638 }
20639 function assertUnreachable(_) {
20640     throw new Error('Error! The input value was not handled.');
20641 }
20642 //# sourceMappingURL=errors.js.map
20643 
20644 /***/ }),
20645 
20646 /***/ 30447:
20647 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20648 
20649 "use strict";
20650 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
20651 /* harmony export */   $G: () => (/* binding */ getExplicitRuleType),
20652 /* harmony export */   EL: () => (/* binding */ findNodesForProperty),
20653 /* harmony export */   UP: () => (/* binding */ isDataTypeRule),
20654 /* harmony export */   VD: () => (/* binding */ getAllReachableRules),
20655 /* harmony export */   eN: () => (/* binding */ getCrossReferenceTerminal),
20656 /* harmony export */   h7: () => (/* binding */ findAssignment),
20657 /* harmony export */   ib: () => (/* binding */ findNameAssignment),
20658 /* harmony export */   lA: () => (/* binding */ findNodeForKeyword),
20659 /* harmony export */   mJ: () => (/* binding */ getRuleType),
20660 /* harmony export */   md: () => (/* binding */ isCommentTerminal),
20661 /* harmony export */   s1: () => (/* binding */ terminalRegex),
20662 /* harmony export */   vb: () => (/* binding */ findNodeForProperty),
20663 /* harmony export */   z$: () => (/* binding */ getTypeName)
20664 /* harmony export */ });
20665 /* unused harmony exports getEntryRule, getHiddenRules, findNodesForKeyword, findNodesForKeywordInternal, getActionAtElement, isOptionalCardinality, isArrayCardinality, isArrayOperator, isDataType, getActionType, getRuleTypeName */
20666 /* harmony import */ var _utils_errors_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(45209);
20667 /* harmony import */ var _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34905);
20668 /* harmony import */ var _syntax_tree_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(91303);
20669 /* harmony import */ var _ast_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(74857);
20670 /* harmony import */ var _cst_utils_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13871);
20671 /* harmony import */ var _regexp_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43078);
20672 /******************************************************************************
20673  * Copyright 2021-2022 TypeFox GmbH
20674  * This program and the accompanying materials are made available under the
20675  * terms of the MIT License, which is available in the project root.
20676  ******************************************************************************/
20677 
20678 
20679 
20680 
20681 
20682 
20683 /**
20684  * Returns the entry rule of the given grammar, if any. If the grammar file does not contain an entry rule,
20685  * the result is `undefined`.
20686  */
20687 function getEntryRule(grammar) {
20688     return grammar.rules.find(e => _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isParserRule */ .F9(e) && e.entry);
20689 }
20690 /**
20691  * Returns all hidden terminal rules of the given grammar, if any.
20692  */
20693 function getHiddenRules(grammar) {
20694     return grammar.rules.filter((e) => _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isTerminalRule */ .MS(e) && e.hidden);
20695 }
20696 /**
20697  * Returns all rules that can be reached from the topmost rules of the specified grammar (entry and hidden terminal rules).
20698  *
20699  * @param grammar The grammar that contains all rules
20700  * @param allTerminals Whether or not to include terminals that are referenced only by other terminals
20701  * @returns A list of referenced parser and terminal rules. If the grammar contains no entry rule,
20702  *      this function returns all rules of the specified grammar.
20703  */
20704 function getAllReachableRules(grammar, allTerminals) {
20705     const ruleNames = new Set();
20706     const entryRule = getEntryRule(grammar);
20707     if (!entryRule) {
20708         return new Set(grammar.rules);
20709     }
20710     const topMostRules = [entryRule].concat(getHiddenRules(grammar));
20711     for (const rule of topMostRules) {
20712         ruleDfs(rule, ruleNames, allTerminals);
20713     }
20714     const rules = new Set();
20715     for (const rule of grammar.rules) {
20716         if (ruleNames.has(rule.name) || (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isTerminalRule */ .MS(rule) && rule.hidden)) {
20717             rules.add(rule);
20718         }
20719     }
20720     return rules;
20721 }
20722 function ruleDfs(rule, visitedSet, allTerminals) {
20723     visitedSet.add(rule.name);
20724     (0,_ast_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .streamAllContents */ .VY)(rule).forEach(node => {
20725         if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isRuleCall */ .t3(node) || (allTerminals && _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isTerminalRuleCall */ .gf(node))) {
20726             const refRule = node.rule.ref;
20727             if (refRule && !visitedSet.has(refRule.name)) {
20728                 ruleDfs(refRule, visitedSet, allTerminals);
20729             }
20730         }
20731     });
20732 }
20733 /**
20734  * Determines the grammar expression used to parse a cross-reference (usually a reference to a terminal rule).
20735  * A cross-reference can declare this expression explicitly in the form `[Type : Terminal]`, but if `Terminal`
20736  * is omitted, this function attempts to infer it from the name of the referenced `Type` (using `findNameAssignment`).
20737  *
20738  * Returns the grammar expression used to parse the given cross-reference, or `undefined` if it is not declared
20739  * and cannot be inferred.
20740  */
20741 function getCrossReferenceTerminal(crossRef) {
20742     if (crossRef.terminal) {
20743         return crossRef.terminal;
20744     }
20745     else if (crossRef.type.ref) {
20746         const nameAssigment = findNameAssignment(crossRef.type.ref);
20747         return nameAssigment === null || nameAssigment === void 0 ? void 0 : nameAssigment.terminal;
20748     }
20749     return undefined;
20750 }
20751 /**
20752  * Determines whether the given terminal rule represents a comment. This is true if the rule is marked
20753  * as `hidden` and it does not match white space. This means every hidden token (i.e. excluded from the AST)
20754  * that contains visible characters is considered a comment.
20755  */
20756 function isCommentTerminal(terminalRule) {
20757     return terminalRule.hidden && !(0,_regexp_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .isWhitespace */ .cb)(terminalRegex(terminalRule));
20758 }
20759 /**
20760  * Find all CST nodes within the given node that contribute to the specified property.
20761  *
20762  * @param node A CST node in which to look for property assignments. If this is undefined, the result is an empty array.
20763  * @param property A property name of the constructed AST node. If this is undefined, the result is an empty array.
20764  */
20765 function findNodesForProperty(node, property) {
20766     if (!node || !property) {
20767         return [];
20768     }
20769     return findNodesForPropertyInternal(node, property, node.astNode, true);
20770 }
20771 /**
20772  * Find a single CST node within the given node that contributes to the specified property.
20773  *
20774  * @param node A CST node in which to look for property assignments. If this is undefined, the result is `undefined`.
20775  * @param property A property name of the constructed AST node. If this is undefined, the result is `undefined`.
20776  * @param index If no index is specified or the index is less than zero, the first found node is returned. If the
20777  *        specified index exceeds the number of assignments to the property, the last found node is returned. Otherwise,
20778  *        the node with the specified index is returned.
20779  */
20780 function findNodeForProperty(node, property, index) {
20781     if (!node || !property) {
20782         return undefined;
20783     }
20784     const nodes = findNodesForPropertyInternal(node, property, node.astNode, true);
20785     if (nodes.length === 0) {
20786         return undefined;
20787     }
20788     if (index !== undefined) {
20789         index = Math.max(0, Math.min(index, nodes.length - 1));
20790     }
20791     else {
20792         index = 0;
20793     }
20794     return nodes[index];
20795 }
20796 function findNodesForPropertyInternal(node, property, element, first) {
20797     if (!first) {
20798         const nodeFeature = (0,_ast_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getContainerOfType */ .V_)(node.grammarSource, _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isAssignment */ .B7);
20799         if (nodeFeature && nodeFeature.feature === property) {
20800             return [node];
20801         }
20802     }
20803     if ((0,_syntax_tree_js__WEBPACK_IMPORTED_MODULE_3__/* .isCompositeCstNode */ .al)(node) && node.astNode === element) {
20804         return node.content.flatMap(e => findNodesForPropertyInternal(e, property, element, false));
20805     }
20806     return [];
20807 }
20808 /**
20809  * Find all CST nodes within the given node that correspond to the specified keyword.
20810  *
20811  * @param node A CST node in which to look for keywords. If this is undefined, the result is an empty array.
20812  * @param keyword A keyword as specified in the grammar.
20813  */
20814 function findNodesForKeyword(node, keyword) {
20815     if (!node) {
20816         return [];
20817     }
20818     return findNodesForKeywordInternal(node, keyword, node === null || node === void 0 ? void 0 : node.astNode);
20819 }
20820 /**
20821  * Find a single CST node within the given node that corresponds to the specified keyword.
20822  *
20823  * @param node A CST node in which to look for keywords. If this is undefined, the result is `undefined`.
20824  * @param keyword A keyword as specified in the grammar.
20825  * @param index If no index is specified or the index is less than zero, the first found node is returned. If the
20826  *        specified index exceeds the number of keyword occurrences, the last found node is returned. Otherwise,
20827  *        the node with the specified index is returned.
20828  */
20829 function findNodeForKeyword(node, keyword, index) {
20830     if (!node) {
20831         return undefined;
20832     }
20833     const nodes = findNodesForKeywordInternal(node, keyword, node === null || node === void 0 ? void 0 : node.astNode);
20834     if (nodes.length === 0) {
20835         return undefined;
20836     }
20837     if (index !== undefined) {
20838         index = Math.max(0, Math.min(index, nodes.length - 1));
20839     }
20840     else {
20841         index = 0;
20842     }
20843     return nodes[index];
20844 }
20845 function findNodesForKeywordInternal(node, keyword, element) {
20846     if (node.astNode !== element) {
20847         return [];
20848     }
20849     if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isKeyword */ .p1(node.grammarSource) && node.grammarSource.value === keyword) {
20850         return [node];
20851     }
20852     const treeIterator = (0,_cst_utils_js__WEBPACK_IMPORTED_MODULE_4__/* .streamCst */ ._t)(node).iterator();
20853     let result;
20854     const keywordNodes = [];
20855     do {
20856         result = treeIterator.next();
20857         if (!result.done) {
20858             const childNode = result.value;
20859             if (childNode.astNode === element) {
20860                 if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isKeyword */ .p1(childNode.grammarSource) && childNode.grammarSource.value === keyword) {
20861                     keywordNodes.push(childNode);
20862                 }
20863             }
20864             else {
20865                 treeIterator.prune();
20866             }
20867         }
20868     } while (!result.done);
20869     return keywordNodes;
20870 }
20871 /**
20872  * If the given CST node was parsed in the context of a property assignment, the respective `Assignment` grammar
20873  * node is returned. If no assignment is found, the result is `undefined`.
20874  *
20875  * @param cstNode A CST node for which to find a property assignment.
20876  */
20877 function findAssignment(cstNode) {
20878     var _a;
20879     const astNode = cstNode.astNode;
20880     // Only search until the ast node of the parent cst node is no longer the original ast node
20881     // This would make us jump to a preceding rule call, which contains only unrelated assignments
20882     while (astNode === ((_a = cstNode.container) === null || _a === void 0 ? void 0 : _a.astNode)) {
20883         const assignment = (0,_ast_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getContainerOfType */ .V_)(cstNode.grammarSource, _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isAssignment */ .B7);
20884         if (assignment) {
20885             return assignment;
20886         }
20887         cstNode = cstNode.container;
20888     }
20889     return undefined;
20890 }
20891 /**
20892  * Find an assignment to the `name` property for the given grammar type. This requires the `type` to be inferred
20893  * from a parser rule, and that rule must contain an assignment to the `name` property. In all other cases,
20894  * this function returns `undefined`.
20895  */
20896 function findNameAssignment(type) {
20897     let startNode = type;
20898     if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isInferredType */ .S_(startNode)) {
20899         // for inferred types, the location to start searching for the name-assignment is different
20900         if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isAction */ .LG(startNode.$container)) {
20901             // a type which is explicitly inferred by an action: investigate the sibbling of the Action node, i.e. start searching at the Action's parent
20902             startNode = startNode.$container.$container;
20903         }
20904         else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isParserRule */ .F9(startNode.$container)) {
20905             // investigate the parser rule with the explicitly inferred type
20906             startNode = startNode.$container;
20907         }
20908         else {
20909             (0,_utils_errors_js__WEBPACK_IMPORTED_MODULE_5__/* .assertUnreachable */ .U)(startNode.$container);
20910         }
20911     }
20912     return findNameAssignmentInternal(type, startNode, new Map());
20913 }
20914 function findNameAssignmentInternal(type, startNode, cache) {
20915     var _a;
20916     // the cache is only required to prevent infinite loops
20917     function go(node, refType) {
20918         let childAssignment = undefined;
20919         const parentAssignment = (0,_ast_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getContainerOfType */ .V_)(node, _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isAssignment */ .B7);
20920         // No parent assignment implies unassigned rule call
20921         if (!parentAssignment) {
20922             childAssignment = findNameAssignmentInternal(refType, refType, cache);
20923         }
20924         cache.set(type, childAssignment);
20925         return childAssignment;
20926     }
20927     if (cache.has(type)) {
20928         return cache.get(type);
20929     }
20930     cache.set(type, undefined);
20931     for (const node of (0,_ast_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .streamAllContents */ .VY)(startNode)) {
20932         if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isAssignment */ .B7(node) && node.feature.toLowerCase() === 'name') {
20933             cache.set(type, node);
20934             return node;
20935         }
20936         else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isRuleCall */ .t3(node) && _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isParserRule */ .F9(node.rule.ref)) {
20937             return go(node, node.rule.ref);
20938         }
20939         else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isSimpleType */ .Iy(node) && ((_a = node.typeRef) === null || _a === void 0 ? void 0 : _a.ref)) {
20940             return go(node, node.typeRef.ref);
20941         }
20942     }
20943     return undefined;
20944 }
20945 function getActionAtElement(element) {
20946     const parent = element.$container;
20947     if (ast.isGroup(parent)) {
20948         const elements = parent.elements;
20949         const index = elements.indexOf(element);
20950         for (let i = index - 1; i >= 0; i--) {
20951             const item = elements[i];
20952             if (ast.isAction(item)) {
20953                 return item;
20954             }
20955             else {
20956                 const action = streamAllContents(elements[i]).find(ast.isAction);
20957                 if (action) {
20958                     return action;
20959                 }
20960             }
20961         }
20962     }
20963     if (ast.isAbstractElement(parent)) {
20964         return getActionAtElement(parent);
20965     }
20966     else {
20967         return undefined;
20968     }
20969 }
20970 function isOptionalCardinality(cardinality, element) {
20971     return cardinality === '?' || cardinality === '*' || (ast.isGroup(element) && Boolean(element.guardCondition));
20972 }
20973 function isArrayCardinality(cardinality) {
20974     return cardinality === '*' || cardinality === '+';
20975 }
20976 function isArrayOperator(operator) {
20977     return operator === '+=';
20978 }
20979 /**
20980  * Determines whether the given parser rule is a _data type rule_, meaning that it has a
20981  * primitive return type like `number`, `boolean`, etc.
20982  */
20983 function isDataTypeRule(rule) {
20984     return isDataTypeRuleInternal(rule, new Set());
20985 }
20986 function isDataTypeRuleInternal(rule, visited) {
20987     if (visited.has(rule)) {
20988         return true;
20989     }
20990     else {
20991         visited.add(rule);
20992     }
20993     for (const node of (0,_ast_utils_js__WEBPACK_IMPORTED_MODULE_1__/* .streamAllContents */ .VY)(rule)) {
20994         if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isRuleCall */ .t3(node)) {
20995             if (!node.rule.ref) {
20996                 // RuleCall to unresolved rule. Don't assume `rule` is a DataType rule.
20997                 return false;
20998             }
20999             if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isParserRule */ .F9(node.rule.ref) && !isDataTypeRuleInternal(node.rule.ref, visited)) {
21000                 return false;
21001             }
21002         }
21003         else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isAssignment */ .B7(node)) {
21004             return false;
21005         }
21006         else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isAction */ .LG(node)) {
21007             return false;
21008         }
21009     }
21010     return Boolean(rule.definition);
21011 }
21012 function isDataType(type) {
21013     return isDataTypeInternal(type.type, new Set());
21014 }
21015 function isDataTypeInternal(type, visited) {
21016     if (visited.has(type)) {
21017         return true;
21018     }
21019     else {
21020         visited.add(type);
21021     }
21022     if (ast.isArrayType(type)) {
21023         return false;
21024     }
21025     else if (ast.isReferenceType(type)) {
21026         return false;
21027     }
21028     else if (ast.isUnionType(type)) {
21029         return type.types.every(e => isDataTypeInternal(e, visited));
21030     }
21031     else if (ast.isSimpleType(type)) {
21032         if (type.primitiveType !== undefined) {
21033             return true;
21034         }
21035         else if (type.stringType !== undefined) {
21036             return true;
21037         }
21038         else if (type.typeRef !== undefined) {
21039             const ref = type.typeRef.ref;
21040             if (ast.isType(ref)) {
21041                 return isDataTypeInternal(ref.type, visited);
21042             }
21043             else {
21044                 return false;
21045             }
21046         }
21047         else {
21048             return false;
21049         }
21050     }
21051     else {
21052         return false;
21053     }
21054 }
21055 function getExplicitRuleType(rule) {
21056     if (rule.inferredType) {
21057         return rule.inferredType.name;
21058     }
21059     else if (rule.dataType) {
21060         return rule.dataType;
21061     }
21062     else if (rule.returnType) {
21063         const refType = rule.returnType.ref;
21064         if (refType) {
21065             // check if we need to check Action as return type
21066             if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isParserRule */ .F9(refType)) {
21067                 return refType.name;
21068             }
21069             else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isInterface */ .QV(refType) || _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isType */ .P9(refType)) {
21070                 return refType.name;
21071             }
21072         }
21073     }
21074     return undefined;
21075 }
21076 function getTypeName(type) {
21077     var _a;
21078     if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isParserRule */ .F9(type)) {
21079         return isDataTypeRule(type) ? type.name : (_a = getExplicitRuleType(type)) !== null && _a !== void 0 ? _a : type.name;
21080     }
21081     else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isInterface */ .QV(type) || _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isType */ .P9(type) || _languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isReturnType */ .Mp(type)) {
21082         return type.name;
21083     }
21084     else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isAction */ .LG(type)) {
21085         const actionType = getActionType(type);
21086         if (actionType) {
21087             return actionType;
21088         }
21089     }
21090     else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isInferredType */ .S_(type)) {
21091         return type.name;
21092     }
21093     throw new Error('Cannot get name of Unknown Type');
21094 }
21095 function getActionType(action) {
21096     var _a;
21097     if (action.inferredType) {
21098         return action.inferredType.name;
21099     }
21100     else if ((_a = action.type) === null || _a === void 0 ? void 0 : _a.ref) {
21101         return getTypeName(action.type.ref);
21102     }
21103     return undefined; // not inferring and not referencing a valid type
21104 }
21105 /**
21106  * This function is used at development time (for code generation and the internal type system) to get the type of the AST node produced by the given rule.
21107  * For data type rules, the name of the rule is returned,
21108  * e.g. "INT_value returns number: MY_INT;" returns "INT_value".
21109  * @param rule the given rule
21110  * @returns the name of the AST node type of the rule
21111  */
21112 function getRuleTypeName(rule) {
21113     var _a, _b, _c;
21114     if (ast.isTerminalRule(rule)) {
21115         return (_b = (_a = rule.type) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'string';
21116     }
21117     else {
21118         return isDataTypeRule(rule) ? rule.name : (_c = getExplicitRuleType(rule)) !== null && _c !== void 0 ? _c : rule.name;
21119     }
21120 }
21121 /**
21122  * This function is used at runtime to get the actual type of the values produced by the given rule at runtime.
21123  * For data type rules, the name of the declared return type of the rule is returned (if any),
21124  * e.g. "INT_value returns number: MY_INT;" returns "number".
21125  * @param rule the given rule
21126  * @returns the name of the type of the produced values of the rule at runtime
21127  */
21128 function getRuleType(rule) {
21129     var _a, _b, _c;
21130     if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isTerminalRule */ .MS(rule)) {
21131         return (_b = (_a = rule.type) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'string';
21132     }
21133     else {
21134         return (_c = getExplicitRuleType(rule)) !== null && _c !== void 0 ? _c : rule.name;
21135     }
21136 }
21137 function terminalRegex(terminalRule) {
21138     const flags = {
21139         s: false,
21140         i: false,
21141         u: false
21142     };
21143     const source = abstractElementToRegex(terminalRule.definition, flags);
21144     const flagText = Object.entries(flags).filter(([, value]) => value).map(([name]) => name).join('');
21145     return new RegExp(source, flagText);
21146 }
21147 // Using [\s\S]* allows to match everything, compared to . which doesn't match line terminators
21148 const WILDCARD = /[\s\S]/.source;
21149 function abstractElementToRegex(element, flags) {
21150     if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isTerminalAlternatives */ .V7(element)) {
21151         return terminalAlternativesToRegex(element);
21152     }
21153     else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isTerminalGroup */ .X9(element)) {
21154         return terminalGroupToRegex(element);
21155     }
21156     else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isCharacterRange */ .Bf(element)) {
21157         return characterRangeToRegex(element);
21158     }
21159     else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isTerminalRuleCall */ .gf(element)) {
21160         const rule = element.rule.ref;
21161         if (!rule) {
21162             throw new Error('Missing rule reference.');
21163         }
21164         return withCardinality(abstractElementToRegex(rule.definition), {
21165             cardinality: element.cardinality,
21166             lookahead: element.lookahead
21167         });
21168     }
21169     else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isNegatedToken */ .Bi(element)) {
21170         return negateTokenToRegex(element);
21171     }
21172     else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isUntilToken */ .OG(element)) {
21173         return untilTokenToRegex(element);
21174     }
21175     else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isRegexToken */ .Sg(element)) {
21176         const lastSlash = element.regex.lastIndexOf('/');
21177         const source = element.regex.substring(1, lastSlash);
21178         const regexFlags = element.regex.substring(lastSlash + 1);
21179         if (flags) {
21180             flags.i = regexFlags.includes('i');
21181             flags.s = regexFlags.includes('s');
21182             flags.u = regexFlags.includes('u');
21183         }
21184         return withCardinality(source, {
21185             cardinality: element.cardinality,
21186             lookahead: element.lookahead,
21187             wrap: false
21188         });
21189     }
21190     else if (_languages_generated_ast_js__WEBPACK_IMPORTED_MODULE_0__/* .isWildcard */ .qm(element)) {
21191         return withCardinality(WILDCARD, {
21192             cardinality: element.cardinality,
21193             lookahead: element.lookahead
21194         });
21195     }
21196     else {
21197         throw new Error(`Invalid terminal element: ${element === null || element === void 0 ? void 0 : element.$type}`);
21198     }
21199 }
21200 function terminalAlternativesToRegex(alternatives) {
21201     return withCardinality(alternatives.elements.map(e => abstractElementToRegex(e)).join('|'), {
21202         cardinality: alternatives.cardinality,
21203         lookahead: alternatives.lookahead
21204     });
21205 }
21206 function terminalGroupToRegex(group) {
21207     return withCardinality(group.elements.map(e => abstractElementToRegex(e)).join(''), {
21208         cardinality: group.cardinality,
21209         lookahead: group.lookahead
21210     });
21211 }
21212 function untilTokenToRegex(until) {
21213     return withCardinality(`${WILDCARD}*?${abstractElementToRegex(until.terminal)}`, {
21214         cardinality: until.cardinality,
21215         lookahead: until.lookahead
21216     });
21217 }
21218 function negateTokenToRegex(negate) {
21219     return withCardinality(`(?!${abstractElementToRegex(negate.terminal)})${WILDCARD}*?`, {
21220         cardinality: negate.cardinality,
21221         lookahead: negate.lookahead
21222     });
21223 }
21224 function characterRangeToRegex(range) {
21225     if (range.right) {
21226         return withCardinality(`[${keywordToRegex(range.left)}-${keywordToRegex(range.right)}]`, {
21227             cardinality: range.cardinality,
21228             lookahead: range.lookahead,
21229             wrap: false
21230         });
21231     }
21232     return withCardinality(keywordToRegex(range.left), {
21233         cardinality: range.cardinality,
21234         lookahead: range.lookahead,
21235         wrap: false
21236     });
21237 }
21238 function keywordToRegex(keyword) {
21239     return (0,_regexp_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .escapeRegExp */ .hr)(keyword.value);
21240 }
21241 function withCardinality(regex, options) {
21242     var _a;
21243     if (options.wrap !== false || options.lookahead) {
21244         regex = `(${(_a = options.lookahead) !== null && _a !== void 0 ? _a : ''}${regex})`;
21245     }
21246     if (options.cardinality) {
21247         return `${regex}${options.cardinality}`;
21248     }
21249     return regex;
21250 }
21251 //# sourceMappingURL=grammar-utils.js.map
21252 
21253 /***/ }),
21254 
21255 /***/ 43078:
21256 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
21257 
21258 "use strict";
21259 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21260 /* harmony export */   K0: () => (/* binding */ NEWLINE_REGEXP),
21261 /* harmony export */   Rn: () => (/* binding */ isMultilineComment),
21262 /* harmony export */   XC: () => (/* binding */ partialMatches),
21263 /* harmony export */   cb: () => (/* binding */ isWhitespace),
21264 /* harmony export */   cp: () => (/* binding */ getCaseInsensitivePattern),
21265 /* harmony export */   hr: () => (/* binding */ escapeRegExp)
21266 /* harmony export */ });
21267 /* unused harmony exports getTerminalParts, whitespaceCharacters, partialRegExp */
21268 /* harmony import */ var _chevrotain_regexp_to_ast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77647);
21269 /******************************************************************************
21270  * Copyright 2021 TypeFox GmbH
21271  * This program and the accompanying materials are made available under the
21272  * terms of the MIT License, which is available in the project root.
21273  ******************************************************************************/
21274 
21275 const NEWLINE_REGEXP = /\r?\n/gm;
21276 const regexpParser = new _chevrotain_regexp_to_ast__WEBPACK_IMPORTED_MODULE_0__/* .RegExpParser */ .O();
21277 /**
21278  * This class is in charge of heuristically identifying start/end tokens of terminals.
21279  *
21280  * The way this works is by doing the following:
21281  * 1. Traverse the regular expression in the "start state"
21282  * 2. Add any encountered sets/single characters to the "start regexp"
21283  * 3. Once we encounter any variable-length content (i.e. with quantifiers such as +/?/*), we enter the "end state"
21284  * 4. In the end state, any sets/single characters are added to an "end stack".
21285  * 5. If we re-encounter any variable-length content we reset the end stack
21286  * 6. We continue visiting the regex until the end, reseting the end stack and rebuilding it as necessary
21287  *
21288  * After traversing a regular expression the `startRegexp/endRegexp` properties allow access to the stored start/end of the terminal
21289  */
21290 class TerminalRegExpVisitor extends _chevrotain_regexp_to_ast__WEBPACK_IMPORTED_MODULE_0__/* .BaseRegExpVisitor */ .e {
21291     constructor() {
21292         super(...arguments);
21293         this.isStarting = true;
21294         this.endRegexpStack = [];
21295         this.multiline = false;
21296     }
21297     get endRegex() {
21298         return this.endRegexpStack.join('');
21299     }
21300     reset(regex) {
21301         this.multiline = false;
21302         this.regex = regex;
21303         this.startRegexp = '';
21304         this.isStarting = true;
21305         this.endRegexpStack = [];
21306     }
21307     visitGroup(node) {
21308         if (node.quantifier) {
21309             this.isStarting = false;
21310             this.endRegexpStack = [];
21311         }
21312     }
21313     visitCharacter(node) {
21314         const char = String.fromCharCode(node.value);
21315         if (!this.multiline && char === '\n') {
21316             this.multiline = true;
21317         }
21318         if (node.quantifier) {
21319             this.isStarting = false;
21320             this.endRegexpStack = [];
21321         }
21322         else {
21323             const escapedChar = escapeRegExp(char);
21324             this.endRegexpStack.push(escapedChar);
21325             if (this.isStarting) {
21326                 this.startRegexp += escapedChar;
21327             }
21328         }
21329     }
21330     visitSet(node) {
21331         if (!this.multiline) {
21332             const set = this.regex.substring(node.loc.begin, node.loc.end);
21333             const regex = new RegExp(set);
21334             this.multiline = Boolean('\n'.match(regex));
21335         }
21336         if (node.quantifier) {
21337             this.isStarting = false;
21338             this.endRegexpStack = [];
21339         }
21340         else {
21341             const set = this.regex.substring(node.loc.begin, node.loc.end);
21342             this.endRegexpStack.push(set);
21343             if (this.isStarting) {
21344                 this.startRegexp += set;
21345             }
21346         }
21347     }
21348     visitChildren(node) {
21349         if (node.type === 'Group') {
21350             // Ignore children of groups with quantifier (+/*/?)
21351             // These groups are unrelated to start/end tokens of terminals
21352             const group = node;
21353             if (group.quantifier) {
21354                 return;
21355             }
21356         }
21357         super.visitChildren(node);
21358     }
21359 }
21360 const visitor = new TerminalRegExpVisitor();
21361 function getTerminalParts(regexp) {
21362     try {
21363         if (typeof regexp !== 'string') {
21364             regexp = regexp.source;
21365         }
21366         regexp = `/${regexp}/`;
21367         const pattern = regexpParser.pattern(regexp);
21368         const parts = [];
21369         for (const alternative of pattern.value.value) {
21370             visitor.reset(regexp);
21371             visitor.visit(alternative);
21372             parts.push({
21373                 start: visitor.startRegexp,
21374                 end: visitor.endRegex
21375             });
21376         }
21377         return parts;
21378     }
21379     catch (_a) {
21380         return [];
21381     }
21382 }
21383 function isMultilineComment(regexp) {
21384     try {
21385         if (typeof regexp === 'string') {
21386             regexp = new RegExp(regexp);
21387         }
21388         regexp = regexp.toString();
21389         visitor.reset(regexp);
21390         // Parsing the pattern might fail (since it's user code)
21391         visitor.visit(regexpParser.pattern(regexp));
21392         return visitor.multiline;
21393     }
21394     catch (_a) {
21395         return false;
21396     }
21397 }
21398 /**
21399  * A set of all characters that are considered whitespace by the '\s' RegExp character class.
21400  * Taken from [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes).
21401  */
21402 const whitespaceCharacters = ('\f\n\r\t\v\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007' +
21403     '\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff').split('');
21404 function isWhitespace(value) {
21405     const regexp = typeof value === 'string' ? new RegExp(value) : value;
21406     return whitespaceCharacters.some((ws) => regexp.test(ws));
21407 }
21408 function escapeRegExp(value) {
21409     return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
21410 }
21411 function getCaseInsensitivePattern(keyword) {
21412     return Array.prototype.map.call(keyword, letter => /\w/.test(letter) ? `[${letter.toLowerCase()}${letter.toUpperCase()}]` : escapeRegExp(letter)).join('');
21413 }
21414 /**
21415  * Determines whether the given input has a partial match with the specified regex.
21416  * @param regex The regex to partially match against
21417  * @param input The input string
21418  * @returns Whether any match exists.
21419  */
21420 function partialMatches(regex, input) {
21421     const partial = partialRegExp(regex);
21422     const match = input.match(partial);
21423     return !!match && match[0].length > 0;
21424 }
21425 /**
21426  * Builds a partial regex from the input regex. A partial regex is able to match incomplete input strings. E.g.
21427  * a partial regex constructed from `/ab/` is able to match the string `a` without needing a following `b` character. However it won't match `b` alone.
21428  * @param regex The input regex to be converted.
21429  * @returns A partial regex constructed from the input regex.
21430  */
21431 function partialRegExp(regex) {
21432     if (typeof regex === 'string') {
21433         regex = new RegExp(regex);
21434     }
21435     const re = regex, source = regex.source;
21436     let i = 0;
21437     function process() {
21438         let result = '', tmp;
21439         function appendRaw(nbChars) {
21440             result += source.substr(i, nbChars);
21441             i += nbChars;
21442         }
21443         function appendOptional(nbChars) {
21444             result += '(?:' + source.substr(i, nbChars) + '|$)';
21445             i += nbChars;
21446         }
21447         while (i < source.length) {
21448             switch (source[i]) {
21449                 case '\\':
21450                     switch (source[i + 1]) {
21451                         case 'c':
21452                             appendOptional(3);
21453                             break;
21454                         case 'x':
21455                             appendOptional(4);
21456                             break;
21457                         case 'u':
21458                             if (re.unicode) {
21459                                 if (source[i + 2] === '{') {
21460                                     appendOptional(source.indexOf('}', i) - i + 1);
21461                                 }
21462                                 else {
21463                                     appendOptional(6);
21464                                 }
21465                             }
21466                             else {
21467                                 appendOptional(2);
21468                             }
21469                             break;
21470                         case 'p':
21471                         case 'P':
21472                             if (re.unicode) {
21473                                 appendOptional(source.indexOf('}', i) - i + 1);
21474                             }
21475                             else {
21476                                 appendOptional(2);
21477                             }
21478                             break;
21479                         case 'k':
21480                             appendOptional(source.indexOf('>', i) - i + 1);
21481                             break;
21482                         default:
21483                             appendOptional(2);
21484                             break;
21485                     }
21486                     break;
21487                 case '[':
21488                     tmp = /\[(?:\\.|.)*?\]/g;
21489                     tmp.lastIndex = i;
21490                     tmp = tmp.exec(source) || [];
21491                     appendOptional(tmp[0].length);
21492                     break;
21493                 case '|':
21494                 case '^':
21495                 case '$':
21496                 case '*':
21497                 case '+':
21498                 case '?':
21499                     appendRaw(1);
21500                     break;
21501                 case '{':
21502                     tmp = /\{\d+,?\d*\}/g;
21503                     tmp.lastIndex = i;
21504                     tmp = tmp.exec(source);
21505                     if (tmp) {
21506                         appendRaw(tmp[0].length);
21507                     }
21508                     else {
21509                         appendOptional(1);
21510                     }
21511                     break;
21512                 case '(':
21513                     if (source[i + 1] === '?') {
21514                         switch (source[i + 2]) {
21515                             case ':':
21516                                 result += '(?:';
21517                                 i += 3;
21518                                 result += process() + '|$)';
21519                                 break;
21520                             case '=':
21521                                 result += '(?=';
21522                                 i += 3;
21523                                 result += process() + ')';
21524                                 break;
21525                             case '!':
21526                                 tmp = i;
21527                                 i += 3;
21528                                 process();
21529                                 result += source.substr(tmp, i - tmp);
21530                                 break;
21531                             case '<':
21532                                 switch (source[i + 3]) {
21533                                     case '=':
21534                                     case '!':
21535                                         tmp = i;
21536                                         i += 4;
21537                                         process();
21538                                         result += source.substr(tmp, i - tmp);
21539                                         break;
21540                                     default:
21541                                         appendRaw(source.indexOf('>', i) - i + 1);
21542                                         result += process() + '|$)';
21543                                         break;
21544                                 }
21545                                 break;
21546                         }
21547                     }
21548                     else {
21549                         appendRaw(1);
21550                         result += process() + '|$)';
21551                     }
21552                     break;
21553                 case ')':
21554                     ++i;
21555                     return result;
21556                 default:
21557                     appendOptional(1);
21558                     break;
21559             }
21560         }
21561         return result;
21562     }
21563     return new RegExp(process(), regex.flags);
21564 }
21565 //# sourceMappingURL=regexp-utils.js.map
21566 
21567 /***/ }),
21568 
21569 /***/ 99293:
21570 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
21571 
21572 "use strict";
21573 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21574 /* harmony export */   Cl: () => (/* binding */ EMPTY_STREAM),
21575 /* harmony export */   IH: () => (/* binding */ Reduction),
21576 /* harmony export */   Ry: () => (/* binding */ DONE_RESULT),
21577 /* harmony export */   Vw: () => (/* binding */ stream),
21578 /* harmony export */   i: () => (/* binding */ StreamImpl),
21579 /* harmony export */   i8: () => (/* binding */ TreeStreamImpl)
21580 /* harmony export */ });
21581 /******************************************************************************
21582  * Copyright 2021 TypeFox GmbH
21583  * This program and the accompanying materials are made available under the
21584  * terms of the MIT License, which is available in the project root.
21585  ******************************************************************************/
21586 /**
21587  * The default implementation of `Stream` works with two input functions:
21588  *  - The first function creates the initial state of an iteration.
21589  *  - The second function gets the current state as argument and returns an `IteratorResult`.
21590  */
21591 class StreamImpl {
21592     constructor(startFn, nextFn) {
21593         this.startFn = startFn;
21594         this.nextFn = nextFn;
21595     }
21596     iterator() {
21597         const iterator = {
21598             state: this.startFn(),
21599             next: () => this.nextFn(iterator.state),
21600             [Symbol.iterator]: () => iterator
21601         };
21602         return iterator;
21603     }
21604     [Symbol.iterator]() {
21605         return this.iterator();
21606     }
21607     isEmpty() {
21608         const iterator = this.iterator();
21609         return Boolean(iterator.next().done);
21610     }
21611     count() {
21612         const iterator = this.iterator();
21613         let count = 0;
21614         let next = iterator.next();
21615         while (!next.done) {
21616             count++;
21617             next = iterator.next();
21618         }
21619         return count;
21620     }
21621     toArray() {
21622         const result = [];
21623         const iterator = this.iterator();
21624         let next;
21625         do {
21626             next = iterator.next();
21627             if (next.value !== undefined) {
21628                 result.push(next.value);
21629             }
21630         } while (!next.done);
21631         return result;
21632     }
21633     toSet() {
21634         return new Set(this);
21635     }
21636     toMap(keyFn, valueFn) {
21637         const entryStream = this.map(element => [
21638             keyFn ? keyFn(element) : element,
21639             valueFn ? valueFn(element) : element
21640         ]);
21641         return new Map(entryStream);
21642     }
21643     toString() {
21644         return this.join();
21645     }
21646     concat(other) {
21647         return new StreamImpl(() => ({ first: this.startFn(), firstDone: false, iterator: other[Symbol.iterator]() }), state => {
21648             let result;
21649             if (!state.firstDone) {
21650                 do {
21651                     result = this.nextFn(state.first);
21652                     if (!result.done) {
21653                         return result;
21654                     }
21655                 } while (!result.done);
21656                 state.firstDone = true;
21657             }
21658             do {
21659                 result = state.iterator.next();
21660                 if (!result.done) {
21661                     return result;
21662                 }
21663             } while (!result.done);
21664             return DONE_RESULT;
21665         });
21666     }
21667     join(separator = ',') {
21668         const iterator = this.iterator();
21669         let value = '';
21670         let result;
21671         let addSeparator = false;
21672         do {
21673             result = iterator.next();
21674             if (!result.done) {
21675                 if (addSeparator) {
21676                     value += separator;
21677                 }
21678                 value += toString(result.value);
21679             }
21680             addSeparator = true;
21681         } while (!result.done);
21682         return value;
21683     }
21684     indexOf(searchElement, fromIndex = 0) {
21685         const iterator = this.iterator();
21686         let index = 0;
21687         let next = iterator.next();
21688         while (!next.done) {
21689             if (index >= fromIndex && next.value === searchElement) {
21690                 return index;
21691             }
21692             next = iterator.next();
21693             index++;
21694         }
21695         return -1;
21696     }
21697     every(predicate) {
21698         const iterator = this.iterator();
21699         let next = iterator.next();
21700         while (!next.done) {
21701             if (!predicate(next.value)) {
21702                 return false;
21703             }
21704             next = iterator.next();
21705         }
21706         return true;
21707     }
21708     some(predicate) {
21709         const iterator = this.iterator();
21710         let next = iterator.next();
21711         while (!next.done) {
21712             if (predicate(next.value)) {
21713                 return true;
21714             }
21715             next = iterator.next();
21716         }
21717         return false;
21718     }
21719     forEach(callbackfn) {
21720         const iterator = this.iterator();
21721         let index = 0;
21722         let next = iterator.next();
21723         while (!next.done) {
21724             callbackfn(next.value, index);
21725             next = iterator.next();
21726             index++;
21727         }
21728     }
21729     map(callbackfn) {
21730         return new StreamImpl(this.startFn, (state) => {
21731             const { done, value } = this.nextFn(state);
21732             if (done) {
21733                 return DONE_RESULT;
21734             }
21735             else {
21736                 return { done: false, value: callbackfn(value) };
21737             }
21738         });
21739     }
21740     filter(predicate) {
21741         return new StreamImpl(this.startFn, state => {
21742             let result;
21743             do {
21744                 result = this.nextFn(state);
21745                 if (!result.done && predicate(result.value)) {
21746                     return result;
21747                 }
21748             } while (!result.done);
21749             return DONE_RESULT;
21750         });
21751     }
21752     nonNullable() {
21753         return this.filter(e => e !== undefined && e !== null);
21754     }
21755     reduce(callbackfn, initialValue) {
21756         const iterator = this.iterator();
21757         let previousValue = initialValue;
21758         let next = iterator.next();
21759         while (!next.done) {
21760             if (previousValue === undefined) {
21761                 previousValue = next.value;
21762             }
21763             else {
21764                 previousValue = callbackfn(previousValue, next.value);
21765             }
21766             next = iterator.next();
21767         }
21768         return previousValue;
21769     }
21770     reduceRight(callbackfn, initialValue) {
21771         return this.recursiveReduce(this.iterator(), callbackfn, initialValue);
21772     }
21773     recursiveReduce(iterator, callbackfn, initialValue) {
21774         const next = iterator.next();
21775         if (next.done) {
21776             return initialValue;
21777         }
21778         const previousValue = this.recursiveReduce(iterator, callbackfn, initialValue);
21779         if (previousValue === undefined) {
21780             return next.value;
21781         }
21782         return callbackfn(previousValue, next.value);
21783     }
21784     find(predicate) {
21785         const iterator = this.iterator();
21786         let next = iterator.next();
21787         while (!next.done) {
21788             if (predicate(next.value)) {
21789                 return next.value;
21790             }
21791             next = iterator.next();
21792         }
21793         return undefined;
21794     }
21795     findIndex(predicate) {
21796         const iterator = this.iterator();
21797         let index = 0;
21798         let next = iterator.next();
21799         while (!next.done) {
21800             if (predicate(next.value)) {
21801                 return index;
21802             }
21803             next = iterator.next();
21804             index++;
21805         }
21806         return -1;
21807     }
21808     includes(searchElement) {
21809         const iterator = this.iterator();
21810         let next = iterator.next();
21811         while (!next.done) {
21812             if (next.value === searchElement) {
21813                 return true;
21814             }
21815             next = iterator.next();
21816         }
21817         return false;
21818     }
21819     flatMap(callbackfn) {
21820         return new StreamImpl(() => ({ this: this.startFn() }), (state) => {
21821             do {
21822                 if (state.iterator) {
21823                     const next = state.iterator.next();
21824                     if (next.done) {
21825                         state.iterator = undefined;
21826                     }
21827                     else {
21828                         return next;
21829                     }
21830                 }
21831                 const { done, value } = this.nextFn(state.this);
21832                 if (!done) {
21833                     const mapped = callbackfn(value);
21834                     if (isIterable(mapped)) {
21835                         state.iterator = mapped[Symbol.iterator]();
21836                     }
21837                     else {
21838                         return { done: false, value: mapped };
21839                     }
21840                 }
21841             } while (state.iterator);
21842             return DONE_RESULT;
21843         });
21844     }
21845     flat(depth) {
21846         if (depth === undefined) {
21847             depth = 1;
21848         }
21849         if (depth <= 0) {
21850             return this;
21851         }
21852         const stream = depth > 1 ? this.flat(depth - 1) : this;
21853         return new StreamImpl(() => ({ this: stream.startFn() }), (state) => {
21854             do {
21855                 if (state.iterator) {
21856                     const next = state.iterator.next();
21857                     if (next.done) {
21858                         state.iterator = undefined;
21859                     }
21860                     else {
21861                         return next;
21862                     }
21863                 }
21864                 const { done, value } = stream.nextFn(state.this);
21865                 if (!done) {
21866                     if (isIterable(value)) {
21867                         state.iterator = value[Symbol.iterator]();
21868                     }
21869                     else {
21870                         return { done: false, value: value };
21871                     }
21872                 }
21873             } while (state.iterator);
21874             return DONE_RESULT;
21875         });
21876     }
21877     head() {
21878         const iterator = this.iterator();
21879         const result = iterator.next();
21880         if (result.done) {
21881             return undefined;
21882         }
21883         return result.value;
21884     }
21885     tail(skipCount = 1) {
21886         return new StreamImpl(() => {
21887             const state = this.startFn();
21888             for (let i = 0; i < skipCount; i++) {
21889                 const next = this.nextFn(state);
21890                 if (next.done) {
21891                     return state;
21892                 }
21893             }
21894             return state;
21895         }, this.nextFn);
21896     }
21897     limit(maxSize) {
21898         return new StreamImpl(() => ({ size: 0, state: this.startFn() }), state => {
21899             state.size++;
21900             if (state.size > maxSize) {
21901                 return DONE_RESULT;
21902             }
21903             return this.nextFn(state.state);
21904         });
21905     }
21906     distinct(by) {
21907         return new StreamImpl(() => ({ set: new Set(), internalState: this.startFn() }), state => {
21908             let result;
21909             do {
21910                 result = this.nextFn(state.internalState);
21911                 if (!result.done) {
21912                     const value = by ? by(result.value) : result.value;
21913                     if (!state.set.has(value)) {
21914                         state.set.add(value);
21915                         return result;
21916                     }
21917                 }
21918             } while (!result.done);
21919             return DONE_RESULT;
21920         });
21921     }
21922     exclude(other, key) {
21923         const otherKeySet = new Set();
21924         for (const item of other) {
21925             const value = key ? key(item) : item;
21926             otherKeySet.add(value);
21927         }
21928         return this.filter(e => {
21929             const ownKey = key ? key(e) : e;
21930             return !otherKeySet.has(ownKey);
21931         });
21932     }
21933 }
21934 function toString(item) {
21935     if (typeof item === 'string') {
21936         return item;
21937     }
21938     if (typeof item === 'undefined') {
21939         return 'undefined';
21940     }
21941     // eslint-disable-next-line @typescript-eslint/no-explicit-any
21942     if (typeof item.toString === 'function') {
21943         // eslint-disable-next-line @typescript-eslint/no-explicit-any
21944         return item.toString();
21945     }
21946     return Object.prototype.toString.call(item);
21947 }
21948 function isIterable(obj) {
21949     return !!obj && typeof obj[Symbol.iterator] === 'function';
21950 }
21951 /**
21952  * An empty stream of any type.
21953  */
21954 // eslint-disable-next-line @typescript-eslint/no-explicit-any
21955 const EMPTY_STREAM = new StreamImpl(() => undefined, () => DONE_RESULT);
21956 /**
21957  * Use this `IteratorResult` when implementing a `StreamImpl` to indicate that there are no more elements in the stream.
21958  */
21959 const DONE_RESULT = Object.freeze({ done: true, value: undefined });
21960 /**
21961  * Create a stream from one or more iterables or array-likes.
21962  */
21963 function stream(...collections) {
21964     if (collections.length === 1) {
21965         const collection = collections[0];
21966         if (collection instanceof StreamImpl) {
21967             return collection;
21968         }
21969         if (isIterable(collection)) {
21970             return new StreamImpl(() => collection[Symbol.iterator](), (iterator) => iterator.next());
21971         }
21972         if (typeof collection.length === 'number') {
21973             return new StreamImpl(() => ({ index: 0 }), (state) => {
21974                 if (state.index < collection.length) {
21975                     return { done: false, value: collection[state.index++] };
21976                 }
21977                 else {
21978                     return DONE_RESULT;
21979                 }
21980             });
21981         }
21982     }
21983     if (collections.length > 1) {
21984         return new StreamImpl(() => ({ collIndex: 0, arrIndex: 0 }), (state) => {
21985             do {
21986                 if (state.iterator) {
21987                     const next = state.iterator.next();
21988                     if (!next.done) {
21989                         return next;
21990                     }
21991                     state.iterator = undefined;
21992                 }
21993                 if (state.array) {
21994                     if (state.arrIndex < state.array.length) {
21995                         return { done: false, value: state.array[state.arrIndex++] };
21996                     }
21997                     state.array = undefined;
21998                     state.arrIndex = 0;
21999                 }
22000                 if (state.collIndex < collections.length) {
22001                     const collection = collections[state.collIndex++];
22002                     if (isIterable(collection)) {
22003                         state.iterator = collection[Symbol.iterator]();
22004                     }
22005                     else if (collection && typeof collection.length === 'number') {
22006                         state.array = collection;
22007                     }
22008                 }
22009             } while (state.iterator || state.array || state.collIndex < collections.length);
22010             return DONE_RESULT;
22011         });
22012     }
22013     return EMPTY_STREAM;
22014 }
22015 /**
22016  * The default implementation of `TreeStream` takes a root element and a function that computes the
22017  * children of its argument. Whether the root node included in the stream is controlled with the
22018  * `includeRoot` option, which defaults to `false`.
22019  */
22020 class TreeStreamImpl extends StreamImpl {
22021     constructor(root, children, options) {
22022         super(() => ({
22023             iterators: (options === null || options === void 0 ? void 0 : options.includeRoot) ? [[root][Symbol.iterator]()] : [children(root)[Symbol.iterator]()],
22024             pruned: false
22025         }), state => {
22026             if (state.pruned) {
22027                 state.iterators.pop();
22028                 state.pruned = false;
22029             }
22030             while (state.iterators.length > 0) {
22031                 const iterator = state.iterators[state.iterators.length - 1];
22032                 const next = iterator.next();
22033                 if (next.done) {
22034                     state.iterators.pop();
22035                 }
22036                 else {
22037                     state.iterators.push(children(next.value)[Symbol.iterator]());
22038                     return next;
22039                 }
22040             }
22041             return DONE_RESULT;
22042         });
22043     }
22044     iterator() {
22045         const iterator = {
22046             state: this.startFn(),
22047             next: () => this.nextFn(iterator.state),
22048             prune: () => {
22049                 iterator.state.pruned = true;
22050             },
22051             [Symbol.iterator]: () => iterator
22052         };
22053         return iterator;
22054     }
22055 }
22056 /**
22057  * A set of utility functions that reduce a stream to a single value.
22058  */
22059 var Reduction;
22060 (function (Reduction) {
22061     /**
22062      * Compute the sum of a number stream.
22063      */
22064     function sum(stream) {
22065         return stream.reduce((a, b) => a + b, 0);
22066     }
22067     Reduction.sum = sum;
22068     /**
22069      * Compute the product of a number stream.
22070      */
22071     function product(stream) {
22072         return stream.reduce((a, b) => a * b, 0);
22073     }
22074     Reduction.product = product;
22075     /**
22076      * Compute the minimum of a number stream. Returns `undefined` if the stream is empty.
22077      */
22078     function min(stream) {
22079         return stream.reduce((a, b) => Math.min(a, b));
22080     }
22081     Reduction.min = min;
22082     /**
22083      * Compute the maximum of a number stream. Returns `undefined` if the stream is empty.
22084      */
22085     function max(stream) {
22086         return stream.reduce((a, b) => Math.max(a, b));
22087     }
22088     Reduction.max = max;
22089 })(Reduction || (Reduction = {}));
22090 //# sourceMappingURL=stream.js.map
22091 
22092 /***/ }),
22093 
22094 /***/ 44014:
22095 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22096 
22097 "use strict";
22098 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22099 /* harmony export */   u: () => (/* binding */ EmptyFileSystem)
22100 /* harmony export */ });
22101 /* unused harmony export EmptyFileSystemProvider */
22102 /******************************************************************************
22103  * Copyright 2022 TypeFox GmbH
22104  * This program and the accompanying materials are made available under the
22105  * terms of the MIT License, which is available in the project root.
22106  ******************************************************************************/
22107 class EmptyFileSystemProvider {
22108     readFile() {
22109         throw new Error('No file system is available.');
22110     }
22111     async readDirectory() {
22112         return [];
22113     }
22114 }
22115 const EmptyFileSystem = {
22116     fileSystemProvider: () => new EmptyFileSystemProvider()
22117 };
22118 //# sourceMappingURL=file-system-provider.js.map
22119 
22120 /***/ }),
22121 
22122 /***/ 41589:
22123 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22124 
22125 "use strict";
22126 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22127 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22128 /* harmony export */ });
22129 /* harmony import */ var _isSymbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59660);
22130 
22131 
22132 /**
22133  * The base implementation of methods like `_.max` and `_.min` which accepts a
22134  * `comparator` to determine the extremum value.
22135  *
22136  * @private
22137  * @param {Array} array The array to iterate over.
22138  * @param {Function} iteratee The iteratee invoked per iteration.
22139  * @param {Function} comparator The comparator used to compare values.
22140  * @returns {*} Returns the extremum value.
22141  */
22142 function baseExtremum(array, iteratee, comparator) {
22143   var index = -1,
22144       length = array.length;
22145 
22146   while (++index < length) {
22147     var value = array[index],
22148         current = iteratee(value);
22149 
22150     if (current != null && (computed === undefined
22151           ? (current === current && !(0,_isSymbol_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(current))
22152           : comparator(current, computed)
22153         )) {
22154       var computed = current,
22155           result = value;
22156     }
22157   }
22158   return result;
22159 }
22160 
22161 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (baseExtremum);
22162 
22163 
22164 /***/ }),
22165 
22166 /***/ 79520:
22167 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22168 
22169 "use strict";
22170 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22171 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22172 /* harmony export */ });
22173 /**
22174  * The base implementation of `_.lt` which doesn't coerce arguments.
22175  *
22176  * @private
22177  * @param {*} value The value to compare.
22178  * @param {*} other The other value to compare.
22179  * @returns {boolean} Returns `true` if `value` is less than `other`,
22180  *  else `false`.
22181  */
22182 function baseLt(value, other) {
22183   return value < other;
22184 }
22185 
22186 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (baseLt);
22187 
22188 
22189 /***/ }),
22190 
22191 /***/ 15521:
22192 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22193 
22194 "use strict";
22195 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22196 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22197 /* harmony export */ });
22198 /* harmony import */ var _baseEach_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(77201);
22199 /* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69959);
22200 
22201 
22202 
22203 /**
22204  * The base implementation of `_.map` without support for iteratee shorthands.
22205  *
22206  * @private
22207  * @param {Array|Object} collection The collection to iterate over.
22208  * @param {Function} iteratee The function invoked per iteration.
22209  * @returns {Array} Returns the new mapped array.
22210  */
22211 function baseMap(collection, iteratee) {
22212   var index = -1,
22213       result = (0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(collection) ? Array(collection.length) : [];
22214 
22215   (0,_baseEach_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(collection, function(value, key, collection) {
22216     result[++index] = iteratee(value, key, collection);
22217   });
22218   return result;
22219 }
22220 
22221 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (baseMap);
22222 
22223 
22224 /***/ }),
22225 
22226 /***/ 73338:
22227 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22228 
22229 "use strict";
22230 
22231 // EXPORTS
22232 __webpack_require__.d(__webpack_exports__, {
22233   Z: () => (/* binding */ _basePickBy)
22234 });
22235 
22236 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseGet.js
22237 var _baseGet = __webpack_require__(78402);
22238 // EXTERNAL MODULE: ../node_modules/lodash-es/_assignValue.js
22239 var _assignValue = __webpack_require__(15561);
22240 // EXTERNAL MODULE: ../node_modules/lodash-es/_castPath.js + 2 modules
22241 var _castPath = __webpack_require__(94022);
22242 // EXTERNAL MODULE: ../node_modules/lodash-es/_isIndex.js
22243 var _isIndex = __webpack_require__(8616);
22244 // EXTERNAL MODULE: ../node_modules/lodash-es/isObject.js
22245 var isObject = __webpack_require__(60417);
22246 // EXTERNAL MODULE: ../node_modules/lodash-es/_toKey.js
22247 var _toKey = __webpack_require__(13550);
22248 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseSet.js
22249 
22250 
22251 
22252 
22253 
22254 
22255 /**
22256  * The base implementation of `_.set`.
22257  *
22258  * @private
22259  * @param {Object} object The object to modify.
22260  * @param {Array|string} path The path of the property to set.
22261  * @param {*} value The value to set.
22262  * @param {Function} [customizer] The function to customize path creation.
22263  * @returns {Object} Returns `object`.
22264  */
22265 function baseSet(object, path, value, customizer) {
22266   if (!(0,isObject/* default */.Z)(object)) {
22267     return object;
22268   }
22269   path = (0,_castPath/* default */.Z)(path, object);
22270 
22271   var index = -1,
22272       length = path.length,
22273       lastIndex = length - 1,
22274       nested = object;
22275 
22276   while (nested != null && ++index < length) {
22277     var key = (0,_toKey/* default */.Z)(path[index]),
22278         newValue = value;
22279 
22280     if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
22281       return object;
22282     }
22283 
22284     if (index != lastIndex) {
22285       var objValue = nested[key];
22286       newValue = customizer ? customizer(objValue, key, nested) : undefined;
22287       if (newValue === undefined) {
22288         newValue = (0,isObject/* default */.Z)(objValue)
22289           ? objValue
22290           : ((0,_isIndex/* default */.Z)(path[index + 1]) ? [] : {});
22291       }
22292     }
22293     (0,_assignValue/* default */.Z)(nested, key, newValue);
22294     nested = nested[key];
22295   }
22296   return object;
22297 }
22298 
22299 /* harmony default export */ const _baseSet = (baseSet);
22300 
22301 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_basePickBy.js
22302 
22303 
22304 
22305 
22306 /**
22307  * The base implementation of  `_.pickBy` without support for iteratee shorthands.
22308  *
22309  * @private
22310  * @param {Object} object The source object.
22311  * @param {string[]} paths The property paths to pick.
22312  * @param {Function} predicate The function invoked per property.
22313  * @returns {Object} Returns the new object.
22314  */
22315 function basePickBy(object, paths, predicate) {
22316   var index = -1,
22317       length = paths.length,
22318       result = {};
22319 
22320   while (++index < length) {
22321     var path = paths[index],
22322         value = (0,_baseGet/* default */.Z)(object, path);
22323 
22324     if (predicate(value, path)) {
22325       _baseSet(result, (0,_castPath/* default */.Z)(path, object), value);
22326     }
22327   }
22328   return result;
22329 }
22330 
22331 /* harmony default export */ const _basePickBy = (basePickBy);
22332 
22333 
22334 /***/ }),
22335 
22336 /***/ 20190:
22337 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22338 
22339 "use strict";
22340 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22341 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22342 /* harmony export */ });
22343 /* harmony import */ var _baseClone_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38193);
22344 
22345 
22346 /** Used to compose bitmasks for cloning. */
22347 var CLONE_SYMBOLS_FLAG = 4;
22348 
22349 /**
22350  * Creates a shallow clone of `value`.
22351  *
22352  * **Note:** This method is loosely based on the
22353  * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
22354  * and supports cloning arrays, array buffers, booleans, date objects, maps,
22355  * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
22356  * arrays. The own enumerable properties of `arguments` objects are cloned
22357  * as plain objects. An empty object is returned for uncloneable values such
22358  * as error objects, functions, DOM nodes, and WeakMaps.
22359  *
22360  * @static
22361  * @memberOf _
22362  * @since 0.1.0
22363  * @category Lang
22364  * @param {*} value The value to clone.
22365  * @returns {*} Returns the cloned value.
22366  * @see _.cloneDeep
22367  * @example
22368  *
22369  * var objects = [{ 'a': 1 }, { 'b': 2 }];
22370  *
22371  * var shallow = _.clone(objects);
22372  * console.log(shallow[0] === objects[0]);
22373  * // => true
22374  */
22375 function clone(value) {
22376   return (0,_baseClone_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(value, CLONE_SYMBOLS_FLAG);
22377 }
22378 
22379 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clone);
22380 
22381 
22382 /***/ }),
22383 
22384 /***/ 65479:
22385 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22386 
22387 "use strict";
22388 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22389 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22390 /* harmony export */ });
22391 /* harmony import */ var _baseRest_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(99719);
22392 /* harmony import */ var _eq_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35050);
22393 /* harmony import */ var _isIterateeCall_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(47952);
22394 /* harmony import */ var _keysIn_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(48441);
22395 
22396 
22397 
22398 
22399 
22400 /** Used for built-in method references. */
22401 var objectProto = Object.prototype;
22402 
22403 /** Used to check objects for own properties. */
22404 var hasOwnProperty = objectProto.hasOwnProperty;
22405 
22406 /**
22407  * Assigns own and inherited enumerable string keyed properties of source
22408  * objects to the destination object for all destination properties that
22409  * resolve to `undefined`. Source objects are applied from left to right.
22410  * Once a property is set, additional values of the same property are ignored.
22411  *
22412  * **Note:** This method mutates `object`.
22413  *
22414  * @static
22415  * @since 0.1.0
22416  * @memberOf _
22417  * @category Object
22418  * @param {Object} object The destination object.
22419  * @param {...Object} [sources] The source objects.
22420  * @returns {Object} Returns `object`.
22421  * @see _.defaultsDeep
22422  * @example
22423  *
22424  * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
22425  * // => { 'a': 1, 'b': 2 }
22426  */
22427 var defaults = (0,_baseRest_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(function(object, sources) {
22428   object = Object(object);
22429 
22430   var index = -1;
22431   var length = sources.length;
22432   var guard = length > 2 ? sources[2] : undefined;
22433 
22434   if (guard && (0,_isIterateeCall_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(sources[0], sources[1], guard)) {
22435     length = 1;
22436   }
22437 
22438   while (++index < length) {
22439     var source = sources[index];
22440     var props = (0,_keysIn_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(source);
22441     var propsIndex = -1;
22442     var propsLength = props.length;
22443 
22444     while (++propsIndex < propsLength) {
22445       var key = props[propsIndex];
22446       var value = object[key];
22447 
22448       if (value === undefined ||
22449           ((0,_eq_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
22450         object[key] = source[key];
22451       }
22452     }
22453   }
22454 
22455   return object;
22456 });
22457 
22458 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (defaults);
22459 
22460 
22461 /***/ }),
22462 
22463 /***/ 90970:
22464 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22465 
22466 "use strict";
22467 
22468 // EXPORTS
22469 __webpack_require__.d(__webpack_exports__, {
22470   Z: () => (/* binding */ lodash_es_find)
22471 });
22472 
22473 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseIteratee.js + 15 modules
22474 var _baseIteratee = __webpack_require__(86494);
22475 // EXTERNAL MODULE: ../node_modules/lodash-es/isArrayLike.js
22476 var isArrayLike = __webpack_require__(69959);
22477 // EXTERNAL MODULE: ../node_modules/lodash-es/keys.js
22478 var keys = __webpack_require__(11723);
22479 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_createFind.js
22480 
22481 
22482 
22483 
22484 /**
22485  * Creates a `_.find` or `_.findLast` function.
22486  *
22487  * @private
22488  * @param {Function} findIndexFunc The function to find the collection index.
22489  * @returns {Function} Returns the new find function.
22490  */
22491 function createFind(findIndexFunc) {
22492   return function(collection, predicate, fromIndex) {
22493     var iterable = Object(collection);
22494     if (!(0,isArrayLike/* default */.Z)(collection)) {
22495       var iteratee = (0,_baseIteratee/* default */.Z)(predicate, 3);
22496       collection = (0,keys/* default */.Z)(collection);
22497       predicate = function(key) { return iteratee(iterable[key], key, iterable); };
22498     }
22499     var index = findIndexFunc(collection, predicate, fromIndex);
22500     return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
22501   };
22502 }
22503 
22504 /* harmony default export */ const _createFind = (createFind);
22505 
22506 // EXTERNAL MODULE: ../node_modules/lodash-es/_baseFindIndex.js
22507 var _baseFindIndex = __webpack_require__(9872);
22508 // EXTERNAL MODULE: ../node_modules/lodash-es/toInteger.js
22509 var toInteger = __webpack_require__(98670);
22510 ;// CONCATENATED MODULE: ../node_modules/lodash-es/findIndex.js
22511 
22512 
22513 
22514 
22515 /* Built-in method references for those with the same name as other `lodash` methods. */
22516 var nativeMax = Math.max;
22517 
22518 /**
22519  * This method is like `_.find` except that it returns the index of the first
22520  * element `predicate` returns truthy for instead of the element itself.
22521  *
22522  * @static
22523  * @memberOf _
22524  * @since 1.1.0
22525  * @category Array
22526  * @param {Array} array The array to inspect.
22527  * @param {Function} [predicate=_.identity] The function invoked per iteration.
22528  * @param {number} [fromIndex=0] The index to search from.
22529  * @returns {number} Returns the index of the found element, else `-1`.
22530  * @example
22531  *
22532  * var users = [
22533  *   { 'user': 'barney',  'active': false },
22534  *   { 'user': 'fred',    'active': false },
22535  *   { 'user': 'pebbles', 'active': true }
22536  * ];
22537  *
22538  * _.findIndex(users, function(o) { return o.user == 'barney'; });
22539  * // => 0
22540  *
22541  * // The `_.matches` iteratee shorthand.
22542  * _.findIndex(users, { 'user': 'fred', 'active': false });
22543  * // => 1
22544  *
22545  * // The `_.matchesProperty` iteratee shorthand.
22546  * _.findIndex(users, ['active', false]);
22547  * // => 0
22548  *
22549  * // The `_.property` iteratee shorthand.
22550  * _.findIndex(users, 'active');
22551  * // => 2
22552  */
22553 function findIndex(array, predicate, fromIndex) {
22554   var length = array == null ? 0 : array.length;
22555   if (!length) {
22556     return -1;
22557   }
22558   var index = fromIndex == null ? 0 : (0,toInteger/* default */.Z)(fromIndex);
22559   if (index < 0) {
22560     index = nativeMax(length + index, 0);
22561   }
22562   return (0,_baseFindIndex/* default */.Z)(array, (0,_baseIteratee/* default */.Z)(predicate, 3), index);
22563 }
22564 
22565 /* harmony default export */ const lodash_es_findIndex = (findIndex);
22566 
22567 ;// CONCATENATED MODULE: ../node_modules/lodash-es/find.js
22568 
22569 
22570 
22571 /**
22572  * Iterates over elements of `collection`, returning the first element
22573  * `predicate` returns truthy for. The predicate is invoked with three
22574  * arguments: (value, index|key, collection).
22575  *
22576  * @static
22577  * @memberOf _
22578  * @since 0.1.0
22579  * @category Collection
22580  * @param {Array|Object} collection The collection to inspect.
22581  * @param {Function} [predicate=_.identity] The function invoked per iteration.
22582  * @param {number} [fromIndex=0] The index to search from.
22583  * @returns {*} Returns the matched element, else `undefined`.
22584  * @example
22585  *
22586  * var users = [
22587  *   { 'user': 'barney',  'age': 36, 'active': true },
22588  *   { 'user': 'fred',    'age': 40, 'active': false },
22589  *   { 'user': 'pebbles', 'age': 1,  'active': true }
22590  * ];
22591  *
22592  * _.find(users, function(o) { return o.age < 40; });
22593  * // => object for 'barney'
22594  *
22595  * // The `_.matches` iteratee shorthand.
22596  * _.find(users, { 'age': 1, 'active': true });
22597  * // => object for 'pebbles'
22598  *
22599  * // The `_.matchesProperty` iteratee shorthand.
22600  * _.find(users, ['active', false]);
22601  * // => object for 'fred'
22602  *
22603  * // The `_.property` iteratee shorthand.
22604  * _.find(users, 'active');
22605  * // => object for 'barney'
22606  */
22607 var find = _createFind(lodash_es_findIndex);
22608 
22609 /* harmony default export */ const lodash_es_find = (find);
22610 
22611 
22612 /***/ }),
22613 
22614 /***/ 34134:
22615 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22616 
22617 "use strict";
22618 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22619 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22620 /* harmony export */ });
22621 /* harmony import */ var _baseFlatten_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65029);
22622 /* harmony import */ var _map_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12930);
22623 
22624 
22625 
22626 /**
22627  * Creates a flattened array of values by running each element in `collection`
22628  * thru `iteratee` and flattening the mapped results. The iteratee is invoked
22629  * with three arguments: (value, index|key, collection).
22630  *
22631  * @static
22632  * @memberOf _
22633  * @since 4.0.0
22634  * @category Collection
22635  * @param {Array|Object} collection The collection to iterate over.
22636  * @param {Function} [iteratee=_.identity] The function invoked per iteration.
22637  * @returns {Array} Returns the new flattened array.
22638  * @example
22639  *
22640  * function duplicate(n) {
22641  *   return [n, n];
22642  * }
22643  *
22644  * _.flatMap([1, 2], duplicate);
22645  * // => [1, 1, 2, 2]
22646  */
22647 function flatMap(collection, iteratee) {
22648   return (0,_baseFlatten_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)((0,_map_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(collection, iteratee), 1);
22649 }
22650 
22651 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (flatMap);
22652 
22653 
22654 /***/ }),
22655 
22656 /***/ 28099:
22657 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22658 
22659 "use strict";
22660 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22661 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22662 /* harmony export */ });
22663 /* harmony import */ var _baseFlatten_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65029);
22664 
22665 
22666 /**
22667  * Flattens `array` a single level deep.
22668  *
22669  * @static
22670  * @memberOf _
22671  * @since 0.1.0
22672  * @category Array
22673  * @param {Array} array The array to flatten.
22674  * @returns {Array} Returns the new flattened array.
22675  * @example
22676  *
22677  * _.flatten([1, [2, [3, [4]], 5]]);
22678  * // => [1, 2, [3, [4]], 5]
22679  */
22680 function flatten(array) {
22681   var length = array == null ? 0 : array.length;
22682   return length ? (0,_baseFlatten_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(array, 1) : [];
22683 }
22684 
22685 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (flatten);
22686 
22687 
22688 /***/ }),
22689 
22690 /***/ 36004:
22691 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22692 
22693 "use strict";
22694 
22695 // EXPORTS
22696 __webpack_require__.d(__webpack_exports__, {
22697   Z: () => (/* binding */ lodash_es_has)
22698 });
22699 
22700 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseHas.js
22701 /** Used for built-in method references. */
22702 var objectProto = Object.prototype;
22703 
22704 /** Used to check objects for own properties. */
22705 var _baseHas_hasOwnProperty = objectProto.hasOwnProperty;
22706 
22707 /**
22708  * The base implementation of `_.has` without support for deep paths.
22709  *
22710  * @private
22711  * @param {Object} [object] The object to query.
22712  * @param {Array|string} key The key to check.
22713  * @returns {boolean} Returns `true` if `key` exists, else `false`.
22714  */
22715 function baseHas(object, key) {
22716   return object != null && _baseHas_hasOwnProperty.call(object, key);
22717 }
22718 
22719 /* harmony default export */ const _baseHas = (baseHas);
22720 
22721 // EXTERNAL MODULE: ../node_modules/lodash-es/_hasPath.js
22722 var _hasPath = __webpack_require__(18625);
22723 ;// CONCATENATED MODULE: ../node_modules/lodash-es/has.js
22724 
22725 
22726 
22727 /**
22728  * Checks if `path` is a direct property of `object`.
22729  *
22730  * @static
22731  * @since 0.1.0
22732  * @memberOf _
22733  * @category Object
22734  * @param {Object} object The object to query.
22735  * @param {Array|string} path The path to check.
22736  * @returns {boolean} Returns `true` if `path` exists, else `false`.
22737  * @example
22738  *
22739  * var object = { 'a': { 'b': 2 } };
22740  * var other = _.create({ 'a': _.create({ 'b': 2 }) });
22741  *
22742  * _.has(object, 'a');
22743  * // => true
22744  *
22745  * _.has(object, 'a.b');
22746  * // => true
22747  *
22748  * _.has(object, ['a', 'b']);
22749  * // => true
22750  *
22751  * _.has(other, 'a');
22752  * // => false
22753  */
22754 function has(object, path) {
22755   return object != null && (0,_hasPath/* default */.Z)(object, path, _baseHas);
22756 }
22757 
22758 /* harmony default export */ const lodash_es_has = (has);
22759 
22760 
22761 /***/ }),
22762 
22763 /***/ 75732:
22764 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22765 
22766 "use strict";
22767 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22768 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22769 /* harmony export */ });
22770 /* harmony import */ var _baseGetTag_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(77070);
22771 /* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64058);
22772 /* harmony import */ var _isObjectLike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9615);
22773 
22774 
22775 
22776 
22777 /** `Object#toString` result references. */
22778 var stringTag = '[object String]';
22779 
22780 /**
22781  * Checks if `value` is classified as a `String` primitive or object.
22782  *
22783  * @static
22784  * @since 0.1.0
22785  * @memberOf _
22786  * @category Lang
22787  * @param {*} value The value to check.
22788  * @returns {boolean} Returns `true` if `value` is a string, else `false`.
22789  * @example
22790  *
22791  * _.isString('abc');
22792  * // => true
22793  *
22794  * _.isString(1);
22795  * // => false
22796  */
22797 function isString(value) {
22798   return typeof value == 'string' ||
22799     (!(0,_isArray_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(value) && (0,_isObjectLike_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(value) && (0,_baseGetTag_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(value) == stringTag);
22800 }
22801 
22802 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (isString);
22803 
22804 
22805 /***/ }),
22806 
22807 /***/ 36411:
22808 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22809 
22810 "use strict";
22811 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22812 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22813 /* harmony export */ });
22814 /**
22815  * Gets the last element of `array`.
22816  *
22817  * @static
22818  * @memberOf _
22819  * @since 0.1.0
22820  * @category Array
22821  * @param {Array} array The array to query.
22822  * @returns {*} Returns the last element of `array`.
22823  * @example
22824  *
22825  * _.last([1, 2, 3]);
22826  * // => 3
22827  */
22828 function last(array) {
22829   var length = array == null ? 0 : array.length;
22830   return length ? array[length - 1] : undefined;
22831 }
22832 
22833 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (last);
22834 
22835 
22836 /***/ }),
22837 
22838 /***/ 12930:
22839 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22840 
22841 "use strict";
22842 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22843 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22844 /* harmony export */ });
22845 /* harmony import */ var _arrayMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33043);
22846 /* harmony import */ var _baseIteratee_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(86494);
22847 /* harmony import */ var _baseMap_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(15521);
22848 /* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64058);
22849 
22850 
22851 
22852 
22853 
22854 /**
22855  * Creates an array of values by running each element in `collection` thru
22856  * `iteratee`. The iteratee is invoked with three arguments:
22857  * (value, index|key, collection).
22858  *
22859  * Many lodash methods are guarded to work as iteratees for methods like
22860  * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
22861  *
22862  * The guarded methods are:
22863  * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
22864  * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
22865  * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
22866  * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
22867  *
22868  * @static
22869  * @memberOf _
22870  * @since 0.1.0
22871  * @category Collection
22872  * @param {Array|Object} collection The collection to iterate over.
22873  * @param {Function} [iteratee=_.identity] The function invoked per iteration.
22874  * @returns {Array} Returns the new mapped array.
22875  * @example
22876  *
22877  * function square(n) {
22878  *   return n * n;
22879  * }
22880  *
22881  * _.map([4, 8], square);
22882  * // => [16, 64]
22883  *
22884  * _.map({ 'a': 4, 'b': 8 }, square);
22885  * // => [16, 64] (iteration order is not guaranteed)
22886  *
22887  * var users = [
22888  *   { 'user': 'barney' },
22889  *   { 'user': 'fred' }
22890  * ];
22891  *
22892  * // The `_.property` iteratee shorthand.
22893  * _.map(users, 'user');
22894  * // => ['barney', 'fred']
22895  */
22896 function map(collection, iteratee) {
22897   var func = (0,_isArray_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(collection) ? _arrayMap_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z : _baseMap_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z;
22898   return func(collection, (0,_baseIteratee_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(iteratee, 3));
22899 }
22900 
22901 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (map);
22902 
22903 
22904 /***/ }),
22905 
22906 /***/ 18519:
22907 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22908 
22909 "use strict";
22910 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22911 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
22912 /* harmony export */ });
22913 /* harmony import */ var _baseExtremum_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41589);
22914 /* harmony import */ var _baseLt_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(79520);
22915 /* harmony import */ var _identity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(64056);
22916 
22917 
22918 
22919 
22920 /**
22921  * Computes the minimum value of `array`. If `array` is empty or falsey,
22922  * `undefined` is returned.
22923  *
22924  * @static
22925  * @since 0.1.0
22926  * @memberOf _
22927  * @category Math
22928  * @param {Array} array The array to iterate over.
22929  * @returns {*} Returns the minimum value.
22930  * @example
22931  *
22932  * _.min([4, 2, 8, 6]);
22933  * // => 2
22934  *
22935  * _.min([]);
22936  * // => undefined
22937  */
22938 function min(array) {
22939   return (array && array.length)
22940     ? (0,_baseExtremum_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(array, _identity_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, _baseLt_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)
22941     : undefined;
22942 }
22943 
22944 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (min);
22945 
22946 
22947 /***/ }),
22948 
22949 /***/ 41291:
22950 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22951 
22952 "use strict";
22953 
22954 // EXPORTS
22955 __webpack_require__.d(__webpack_exports__, {
22956   Z: () => (/* binding */ lodash_es_toFinite)
22957 });
22958 
22959 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_trimmedEndIndex.js
22960 /** Used to match a single whitespace character. */
22961 var reWhitespace = /\s/;
22962 
22963 /**
22964  * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
22965  * character of `string`.
22966  *
22967  * @private
22968  * @param {string} string The string to inspect.
22969  * @returns {number} Returns the index of the last non-whitespace character.
22970  */
22971 function trimmedEndIndex(string) {
22972   var index = string.length;
22973 
22974   while (index-- && reWhitespace.test(string.charAt(index))) {}
22975   return index;
22976 }
22977 
22978 /* harmony default export */ const _trimmedEndIndex = (trimmedEndIndex);
22979 
22980 ;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseTrim.js
22981 
22982 
22983 /** Used to match leading whitespace. */
22984 var reTrimStart = /^\s+/;
22985 
22986 /**
22987  * The base implementation of `_.trim`.
22988  *
22989  * @private
22990  * @param {string} string The string to trim.
22991  * @returns {string} Returns the trimmed string.
22992  */
22993 function baseTrim(string) {
22994   return string
22995     ? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '')
22996     : string;
22997 }
22998 
22999 /* harmony default export */ const _baseTrim = (baseTrim);
23000 
23001 // EXTERNAL MODULE: ../node_modules/lodash-es/isObject.js
23002 var isObject = __webpack_require__(60417);
23003 // EXTERNAL MODULE: ../node_modules/lodash-es/isSymbol.js
23004 var isSymbol = __webpack_require__(59660);
23005 ;// CONCATENATED MODULE: ../node_modules/lodash-es/toNumber.js
23006 
23007 
23008 
23009 
23010 /** Used as references for various `Number` constants. */
23011 var NAN = 0 / 0;
23012 
23013 /** Used to detect bad signed hexadecimal string values. */
23014 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
23015 
23016 /** Used to detect binary string values. */
23017 var reIsBinary = /^0b[01]+$/i;
23018 
23019 /** Used to detect octal string values. */
23020 var reIsOctal = /^0o[0-7]+$/i;
23021 
23022 /** Built-in method references without a dependency on `root`. */
23023 var freeParseInt = parseInt;
23024 
23025 /**
23026  * Converts `value` to a number.
23027  *
23028  * @static
23029  * @memberOf _
23030  * @since 4.0.0
23031  * @category Lang
23032  * @param {*} value The value to process.
23033  * @returns {number} Returns the number.
23034  * @example
23035  *
23036  * _.toNumber(3.2);
23037  * // => 3.2
23038  *
23039  * _.toNumber(Number.MIN_VALUE);
23040  * // => 5e-324
23041  *
23042  * _.toNumber(Infinity);
23043  * // => Infinity
23044  *
23045  * _.toNumber('3.2');
23046  * // => 3.2
23047  */
23048 function toNumber(value) {
23049   if (typeof value == 'number') {
23050     return value;
23051   }
23052   if ((0,isSymbol/* default */.Z)(value)) {
23053     return NAN;
23054   }
23055   if ((0,isObject/* default */.Z)(value)) {
23056     var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
23057     value = (0,isObject/* default */.Z)(other) ? (other + '') : other;
23058   }
23059   if (typeof value != 'string') {
23060     return value === 0 ? value : +value;
23061   }
23062   value = _baseTrim(value);
23063   var isBinary = reIsBinary.test(value);
23064   return (isBinary || reIsOctal.test(value))
23065     ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
23066     : (reIsBadHex.test(value) ? NAN : +value);
23067 }
23068 
23069 /* harmony default export */ const lodash_es_toNumber = (toNumber);
23070 
23071 ;// CONCATENATED MODULE: ../node_modules/lodash-es/toFinite.js
23072 
23073 
23074 /** Used as references for various `Number` constants. */
23075 var INFINITY = 1 / 0,
23076     MAX_INTEGER = 1.7976931348623157e+308;
23077 
23078 /**
23079  * Converts `value` to a finite number.
23080  *
23081  * @static
23082  * @memberOf _
23083  * @since 4.12.0
23084  * @category Lang
23085  * @param {*} value The value to convert.
23086  * @returns {number} Returns the converted number.
23087  * @example
23088  *
23089  * _.toFinite(3.2);
23090  * // => 3.2
23091  *
23092  * _.toFinite(Number.MIN_VALUE);
23093  * // => 5e-324
23094  *
23095  * _.toFinite(Infinity);
23096  * // => 1.7976931348623157e+308
23097  *
23098  * _.toFinite('3.2');
23099  * // => 3.2
23100  */
23101 function toFinite(value) {
23102   if (!value) {
23103     return value === 0 ? value : 0;
23104   }
23105   value = lodash_es_toNumber(value);
23106   if (value === INFINITY || value === -INFINITY) {
23107     var sign = (value < 0 ? -1 : 1);
23108     return sign * MAX_INTEGER;
23109   }
23110   return value === value ? value : 0;
23111 }
23112 
23113 /* harmony default export */ const lodash_es_toFinite = (toFinite);
23114 
23115 
23116 /***/ }),
23117 
23118 /***/ 98670:
23119 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23120 
23121 "use strict";
23122 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23123 /* harmony export */   Z: () => (__WEBPACK_DEFAULT_EXPORT__)
23124 /* harmony export */ });
23125 /* harmony import */ var _toFinite_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41291);
23126 
23127 
23128 /**
23129  * Converts `value` to an integer.
23130  *
23131  * **Note:** This method is loosely based on
23132  * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
23133  *
23134  * @static
23135  * @memberOf _
23136  * @since 4.0.0
23137  * @category Lang
23138  * @param {*} value The value to convert.
23139  * @returns {number} Returns the converted integer.
23140  * @example
23141  *
23142  * _.toInteger(3.2);
23143  * // => 3
23144  *
23145  * _.toInteger(Number.MIN_VALUE);
23146  * // => 0
23147  *
23148  * _.toInteger(Infinity);
23149  * // => 1.7976931348623157e+308
23150  *
23151  * _.toInteger('3.2');
23152  * // => 3
23153  */
23154 function toInteger(value) {
23155   var result = (0,_toFinite_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(value),
23156       remainder = result % 1;
23157 
23158   return result === result ? (remainder ? result - remainder : result) : 0;
23159 }
23160 
23161 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (toInteger);
23162 
23163 
23164 /***/ }),
23165 
23166 /***/ 27061:
23167 /***/ ((module) => {
23168 
23169 // shim for using process in browser
23170 var process = module.exports = {};
23171 
23172 // cached from whatever global is present so that test runners that stub it
23173 // don't break things.  But we need to wrap it in a try catch in case it is
23174 // wrapped in strict mode code which doesn't define any globals.  It's inside a
23175 // function because try/catches deoptimize in certain engines.
23176 
23177 var cachedSetTimeout;
23178 var cachedClearTimeout;
23179 
23180 function defaultSetTimout() {
23181     throw new Error('setTimeout has not been defined');
23182 }
23183 function defaultClearTimeout () {
23184     throw new Error('clearTimeout has not been defined');
23185 }
23186 (function () {
23187     try {
23188         if (typeof setTimeout === 'function') {
23189             cachedSetTimeout = setTimeout;
23190         } else {
23191             cachedSetTimeout = defaultSetTimout;
23192         }
23193     } catch (e) {
23194         cachedSetTimeout = defaultSetTimout;
23195     }
23196     try {
23197         if (typeof clearTimeout === 'function') {
23198             cachedClearTimeout = clearTimeout;
23199         } else {
23200             cachedClearTimeout = defaultClearTimeout;
23201         }
23202     } catch (e) {
23203         cachedClearTimeout = defaultClearTimeout;
23204     }
23205 } ())
23206 function runTimeout(fun) {
23207     if (cachedSetTimeout === setTimeout) {
23208         //normal enviroments in sane situations
23209         return setTimeout(fun, 0);
23210     }
23211     // if setTimeout wasn't available but was latter defined
23212     if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
23213         cachedSetTimeout = setTimeout;
23214         return setTimeout(fun, 0);
23215     }
23216     try {
23217         // when when somebody has screwed with setTimeout but no I.E. maddness
23218         return cachedSetTimeout(fun, 0);
23219     } catch(e){
23220         try {
23221             // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
23222             return cachedSetTimeout.call(null, fun, 0);
23223         } catch(e){
23224             // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
23225             return cachedSetTimeout.call(this, fun, 0);
23226         }
23227     }
23228 
23229 
23230 }
23231 function runClearTimeout(marker) {
23232     if (cachedClearTimeout === clearTimeout) {
23233         //normal enviroments in sane situations
23234         return clearTimeout(marker);
23235     }
23236     // if clearTimeout wasn't available but was latter defined
23237     if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
23238         cachedClearTimeout = clearTimeout;
23239         return clearTimeout(marker);
23240     }
23241     try {
23242         // when when somebody has screwed with setTimeout but no I.E. maddness
23243         return cachedClearTimeout(marker);
23244     } catch (e){
23245         try {
23246             // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
23247             return cachedClearTimeout.call(null, marker);
23248         } catch (e){
23249             // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
23250             // Some versions of I.E. have different rules for clearTimeout vs setTimeout
23251             return cachedClearTimeout.call(this, marker);
23252         }
23253     }
23254 
23255 
23256 
23257 }
23258 var queue = [];
23259 var draining = false;
23260 var currentQueue;
23261 var queueIndex = -1;
23262 
23263 function cleanUpNextTick() {
23264     if (!draining || !currentQueue) {
23265         return;
23266     }
23267     draining = false;
23268     if (currentQueue.length) {
23269         queue = currentQueue.concat(queue);
23270     } else {
23271         queueIndex = -1;
23272     }
23273     if (queue.length) {
23274         drainQueue();
23275     }
23276 }
23277 
23278 function drainQueue() {
23279     if (draining) {
23280         return;
23281     }
23282     var timeout = runTimeout(cleanUpNextTick);
23283     draining = true;
23284 
23285     var len = queue.length;
23286     while(len) {
23287         currentQueue = queue;
23288         queue = [];
23289         while (++queueIndex < len) {
23290             if (currentQueue) {
23291                 currentQueue[queueIndex].run();
23292             }
23293         }
23294         queueIndex = -1;
23295         len = queue.length;
23296     }
23297     currentQueue = null;
23298     draining = false;
23299     runClearTimeout(timeout);
23300 }
23301 
23302 process.nextTick = function (fun) {
23303     var args = new Array(arguments.length - 1);
23304     if (arguments.length > 1) {
23305         for (var i = 1; i < arguments.length; i++) {
23306             args[i - 1] = arguments[i];
23307         }
23308     }
23309     queue.push(new Item(fun, args));
23310     if (queue.length === 1 && !draining) {
23311         runTimeout(drainQueue);
23312     }
23313 };
23314 
23315 // v8 likes predictible objects
23316 function Item(fun, array) {
23317     this.fun = fun;
23318     this.array = array;
23319 }
23320 Item.prototype.run = function () {
23321     this.fun.apply(null, this.array);
23322 };
23323 process.title = 'browser';
23324 process.browser = true;
23325 process.env = {};
23326 process.argv = [];
23327 process.version = ''; // empty string to avoid regexp issues
23328 process.versions = {};
23329 
23330 function noop() {}
23331 
23332 process.on = noop;
23333 process.addListener = noop;
23334 process.once = noop;
23335 process.off = noop;
23336 process.removeListener = noop;
23337 process.removeAllListeners = noop;
23338 process.emit = noop;
23339 process.prependListener = noop;
23340 process.prependOnceListener = noop;
23341 
23342 process.listeners = function (name) { return [] }
23343 
23344 process.binding = function (name) {
23345     throw new Error('process.binding is not supported');
23346 };
23347 
23348 process.cwd = function () { return '/' };
23349 process.chdir = function (dir) {
23350     throw new Error('process.chdir is not supported');
23351 };
23352 process.umask = function() { return 0; };
23353 
23354 
23355 /***/ }),
23356 
23357 /***/ 97770:
23358 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
23359 
23360 "use strict";
23361 
23362 /*--------------------------------------------------------------------------------------------- 
23363  *  Copyright (c) Microsoft Corporation. All rights reserved. 
23364  *  Licensed under the MIT License. See License.txt in the project root for license information. 
23365  *--------------------------------------------------------------------------------------------*/
23366 Object.defineProperty(exports, "__esModule", ({ value: true }));
23367 exports.CancellationTokenSource = exports.CancellationToken = void 0;
23368 const ral_1 = __webpack_require__(48094);
23369 const Is = __webpack_require__(78472);
23370 const events_1 = __webpack_require__(345);
23371 var CancellationToken;
23372 (function (CancellationToken) {
23373     CancellationToken.None = Object.freeze({
23374         isCancellationRequested: false,
23375         onCancellationRequested: events_1.Event.None
23376     });
23377     CancellationToken.Cancelled = Object.freeze({
23378         isCancellationRequested: true,
23379         onCancellationRequested: events_1.Event.None
23380     });
23381     function is(value) {
23382         const candidate = value;
23383         return candidate && (candidate === CancellationToken.None
23384             || candidate === CancellationToken.Cancelled
23385             || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));
23386     }
23387     CancellationToken.is = is;
23388 })(CancellationToken || (exports.CancellationToken = CancellationToken = {}));
23389 const shortcutEvent = Object.freeze(function (callback, context) {
23390     const handle = (0, ral_1.default)().timer.setTimeout(callback.bind(context), 0);
23391     return { dispose() { handle.dispose(); } };
23392 });
23393 class MutableToken {
23394     constructor() {
23395         this._isCancelled = false;
23396     }
23397     cancel() {
23398         if (!this._isCancelled) {
23399             this._isCancelled = true;
23400             if (this._emitter) {
23401                 this._emitter.fire(undefined);
23402                 this.dispose();
23403             }
23404         }
23405     }
23406     get isCancellationRequested() {
23407         return this._isCancelled;
23408     }
23409     get onCancellationRequested() {
23410         if (this._isCancelled) {
23411             return shortcutEvent;
23412         }
23413         if (!this._emitter) {
23414             this._emitter = new events_1.Emitter();
23415         }
23416         return this._emitter.event;
23417     }
23418     dispose() {
23419         if (this._emitter) {
23420             this._emitter.dispose();
23421             this._emitter = undefined;
23422         }
23423     }
23424 }
23425 class CancellationTokenSource {
23426     get token() {
23427         if (!this._token) {
23428             // be lazy and create the token only when
23429             // actually needed
23430             this._token = new MutableToken();
23431         }
23432         return this._token;
23433     }
23434     cancel() {
23435         if (!this._token) {
23436             // save an object by returning the default
23437             // cancelled token when cancellation happens
23438             // before someone asks for the token
23439             this._token = CancellationToken.Cancelled;
23440         }
23441         else {
23442             this._token.cancel();
23443         }
23444     }
23445     dispose() {
23446         if (!this._token) {
23447             // ensure to initialize with an empty token if we had none
23448             this._token = CancellationToken.None;
23449         }
23450         else if (this._token instanceof MutableToken) {
23451             // actually dispose
23452             this._token.dispose();
23453         }
23454     }
23455 }
23456 exports.CancellationTokenSource = CancellationTokenSource;
23457 
23458 
23459 /***/ }),
23460 
23461 /***/ 345:
23462 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
23463 
23464 "use strict";
23465 
23466 /* -------------------------------------------------------------------------------------------- 
23467  * Copyright (c) Microsoft Corporation. All rights reserved. 
23468  * Licensed under the MIT License. See License.txt in the project root for license information. 
23469  * ------------------------------------------------------------------------------------------ */
23470 Object.defineProperty(exports, "__esModule", ({ value: true }));
23471 exports.Emitter = exports.Event = void 0;
23472 const ral_1 = __webpack_require__(48094);
23473 var Event;
23474 (function (Event) {
23475     const _disposable = { dispose() { } };
23476     Event.None = function () { return _disposable; };
23477 })(Event || (exports.Event = Event = {}));
23478 class CallbackList {
23479     add(callback, context = null, bucket) {
23480         if (!this._callbacks) {
23481             this._callbacks = [];
23482             this._contexts = [];
23483         }
23484         this._callbacks.push(callback);
23485         this._contexts.push(context);
23486         if (Array.isArray(bucket)) {
23487             bucket.push({ dispose: () => this.remove(callback, context) });
23488         }
23489     }
23490     remove(callback, context = null) {
23491         if (!this._callbacks) {
23492             return;
23493         }
23494         let foundCallbackWithDifferentContext = false;
23495         for (let i = 0, len = this._callbacks.length; i < len; i++) {
23496             if (this._callbacks[i] === callback) {
23497                 if (this._contexts[i] === context) {
23498                     // callback & context match => remove it
23499                     this._callbacks.splice(i, 1);
23500                     this._contexts.splice(i, 1);
23501                     return;
23502                 }
23503                 else {
23504                     foundCallbackWithDifferentContext = true;
23505                 }
23506             }
23507         }
23508         if (foundCallbackWithDifferentContext) {
23509             throw new Error('When adding a listener with a context, you should remove it with the same context');
23510         }
23511     }
23512     invoke(...args) {
23513         if (!this._callbacks) {
23514             return [];
23515         }
23516         const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
23517         for (let i = 0, len = callbacks.length; i < len; i++) {
23518             try {
23519                 ret.push(callbacks[i].apply(contexts[i], args));
23520             }
23521             catch (e) {
23522                 // eslint-disable-next-line no-console
23523                 (0, ral_1.default)().console.error(e);
23524             }
23525         }
23526         return ret;
23527     }
23528     isEmpty() {
23529         return !this._callbacks || this._callbacks.length === 0;
23530     }
23531     dispose() {
23532         this._callbacks = undefined;
23533         this._contexts = undefined;
23534     }
23535 }
23536 class Emitter {
23537     constructor(_options) {
23538         this._options = _options;
23539     }
23540     /**
23541      * For the public to allow to subscribe
23542      * to events from this Emitter
23543      */
23544     get event() {
23545         if (!this._event) {
23546             this._event = (listener, thisArgs, disposables) => {
23547                 if (!this._callbacks) {
23548                     this._callbacks = new CallbackList();
23549                 }
23550                 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
23551                     this._options.onFirstListenerAdd(this);
23552                 }
23553                 this._callbacks.add(listener, thisArgs);
23554                 const result = {
23555                     dispose: () => {
23556                         if (!this._callbacks) {
23557                             // disposable is disposed after emitter is disposed.
23558                             return;
23559                         }
23560                         this._callbacks.remove(listener, thisArgs);
23561                         result.dispose = Emitter._noop;
23562                         if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
23563                             this._options.onLastListenerRemove(this);
23564                         }
23565                     }
23566                 };
23567                 if (Array.isArray(disposables)) {
23568                     disposables.push(result);
23569                 }
23570                 return result;
23571             };
23572         }
23573         return this._event;
23574     }
23575     /**
23576      * To be kept private to fire an event to
23577      * subscribers
23578      */
23579     fire(event) {
23580         if (this._callbacks) {
23581             this._callbacks.invoke.call(this._callbacks, event);
23582         }
23583     }
23584     dispose() {
23585         if (this._callbacks) {
23586             this._callbacks.dispose();
23587             this._callbacks = undefined;
23588         }
23589     }
23590 }
23591 exports.Emitter = Emitter;
23592 Emitter._noop = function () { };
23593 
23594 
23595 /***/ }),
23596 
23597 /***/ 78472:
23598 /***/ ((__unused_webpack_module, exports) => {
23599 
23600 "use strict";
23601 
23602 /* -------------------------------------------------------------------------------------------- 
23603  * Copyright (c) Microsoft Corporation. All rights reserved. 
23604  * Licensed under the MIT License. See License.txt in the project root for license information. 
23605  * ------------------------------------------------------------------------------------------ */
23606 Object.defineProperty(exports, "__esModule", ({ value: true }));
23607 exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
23608 function boolean(value) {
23609     return value === true || value === false;
23610 }
23611 exports.boolean = boolean;
23612 function string(value) {
23613     return typeof value === 'string' || value instanceof String;
23614 }
23615 exports.string = string;
23616 function number(value) {
23617     return typeof value === 'number' || value instanceof Number;
23618 }
23619 exports.number = number;
23620 function error(value) {
23621     return value instanceof Error;
23622 }
23623 exports.error = error;
23624 function func(value) {
23625     return typeof value === 'function';
23626 }
23627 exports.func = func;
23628 function array(value) {
23629     return Array.isArray(value);
23630 }
23631 exports.array = array;
23632 function stringArray(value) {
23633     return array(value) && value.every(elem => string(elem));
23634 }
23635 exports.stringArray = stringArray;
23636 
23637 
23638 /***/ }),
23639 
23640 /***/ 48094:
23641 /***/ ((__unused_webpack_module, exports) => {
23642 
23643 "use strict";
23644 
23645 /* -------------------------------------------------------------------------------------------- 
23646  * Copyright (c) Microsoft Corporation. All rights reserved. 
23647  * Licensed under the MIT License. See License.txt in the project root for license information. 
23648  * ------------------------------------------------------------------------------------------ */
23649 Object.defineProperty(exports, "__esModule", ({ value: true }));
23650 let _ral;
23651 function RAL() {
23652     if (_ral === undefined) {
23653         throw new Error(`No runtime abstraction layer installed`);
23654     }
23655     return _ral;
23656 }
23657 (function (RAL) {
23658     function install(ral) {
23659         if (ral === undefined) {
23660             throw new Error(`No runtime abstraction layer provided`);
23661         }
23662         _ral = ral;
23663     }
23664     RAL.install = install;
23665 })(RAL || (RAL = {}));
23666 exports["default"] = RAL;
23667 
23668 
23669 /***/ }),
23670 
23671 /***/ 37943:
23672 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23673 
23674 "use strict";
23675 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23676 /* harmony export */   c: () => (/* binding */ Utils),
23677 /* harmony export */   o: () => (/* binding */ URI)
23678 /* harmony export */ });
23679 /* provided dependency */ var process = __webpack_require__(27061);
23680 var LIB;(()=>{"use strict";var t={470:t=>{function e(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function r(t,e){for(var r,n="",i=0,o=-1,s=0,h=0;h<=t.length;++h){if(h<t.length)r=t.charCodeAt(h);else{if(47===r)break;r=47}if(47===r){if(o===h-1||1===s);else if(o!==h-1&&2===s){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var a=n.lastIndexOf("/");if(a!==n.length-1){-1===a?(n="",i=0):i=(n=n.slice(0,a)).length-1-n.lastIndexOf("/"),o=h,s=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=h,s=0;continue}e&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+t.slice(o+1,h):n=t.slice(o+1,h),i=h-o-1;o=h,s=0}else 46===r&&-1!==s?++s:s=-1}return n}var n={resolve:function(){for(var t,n="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s;o>=0?s=arguments[o]:(void 0===t&&(t=process.cwd()),s=t),e(s),0!==s.length&&(n=s+"/"+n,i=47===s.charCodeAt(0))}return n=r(n,!i),i?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(t){if(e(t),0===t.length)return".";var n=47===t.charCodeAt(0),i=47===t.charCodeAt(t.length-1);return 0!==(t=r(t,!n)).length||n||(t="."),t.length>0&&i&&(t+="/"),n?"/"+t:t},isAbsolute:function(t){return e(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,r=0;r<arguments.length;++r){var i=arguments[r];e(i),i.length>0&&(void 0===t?t=i:t+="/"+i)}return void 0===t?".":n.normalize(t)},relative:function(t,r){if(e(t),e(r),t===r)return"";if((t=n.resolve(t))===(r=n.resolve(r)))return"";for(var i=1;i<t.length&&47===t.charCodeAt(i);++i);for(var o=t.length,s=o-i,h=1;h<r.length&&47===r.charCodeAt(h);++h);for(var a=r.length-h,c=s<a?s:a,f=-1,u=0;u<=c;++u){if(u===c){if(a>c){if(47===r.charCodeAt(h+u))return r.slice(h+u+1);if(0===u)return r.slice(h+u)}else s>c&&(47===t.charCodeAt(i+u)?f=u:0===u&&(f=0));break}var l=t.charCodeAt(i+u);if(l!==r.charCodeAt(h+u))break;47===l&&(f=u)}var g="";for(u=i+f+1;u<=o;++u)u!==o&&47!==t.charCodeAt(u)||(0===g.length?g+="..":g+="/..");return g.length>0?g+r.slice(h+f):(h+=f,47===r.charCodeAt(h)&&++h,r.slice(h))},_makeLong:function(t){return t},dirname:function(t){if(e(t),0===t.length)return".";for(var r=t.charCodeAt(0),n=47===r,i=-1,o=!0,s=t.length-1;s>=1;--s)if(47===(r=t.charCodeAt(s))){if(!o){i=s;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":t.slice(0,i)},basename:function(t,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');e(t);var n,i=0,o=-1,s=!0;if(void 0!==r&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return"";var h=r.length-1,a=-1;for(n=t.length-1;n>=0;--n){var c=t.charCodeAt(n);if(47===c){if(!s){i=n+1;break}}else-1===a&&(s=!1,a=n+1),h>=0&&(c===r.charCodeAt(h)?-1==--h&&(o=n):(h=-1,o=a))}return i===o?o=a:-1===o&&(o=t.length),t.slice(i,o)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!s){i=n+1;break}}else-1===o&&(s=!1,o=n+1);return-1===o?"":t.slice(i,o)},extname:function(t){e(t);for(var r=-1,n=0,i=-1,o=!0,s=0,h=t.length-1;h>=0;--h){var a=t.charCodeAt(h);if(47!==a)-1===i&&(o=!1,i=h+1),46===a?-1===r?r=h:1!==s&&(s=1):-1!==r&&(s=-1);else if(!o){n=h+1;break}}return-1===r||-1===i||0===s||1===s&&r===i-1&&r===n+1?"":t.slice(r,i)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+"/"+n:n}(0,t)},parse:function(t){e(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return r;var n,i=t.charCodeAt(0),o=47===i;o?(r.root="/",n=1):n=0;for(var s=-1,h=0,a=-1,c=!0,f=t.length-1,u=0;f>=n;--f)if(47!==(i=t.charCodeAt(f)))-1===a&&(c=!1,a=f+1),46===i?-1===s?s=f:1!==u&&(u=1):-1!==s&&(u=-1);else if(!c){h=f+1;break}return-1===s||-1===a||0===u||1===u&&s===a-1&&s===h+1?-1!==a&&(r.base=r.name=0===h&&o?t.slice(1,a):t.slice(h,a)):(0===h&&o?(r.name=t.slice(1,s),r.base=t.slice(1,a)):(r.name=t.slice(h,s),r.base=t.slice(h,a)),r.ext=t.slice(s,a)),h>0?r.dir=t.slice(0,h-1):o&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,t.exports=n}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{let t;if(r.r(n),r.d(n,{URI:()=>f,Utils:()=>P}),"object"==typeof process)t="win32"===process.platform;else if("object"==typeof navigator){let e=navigator.userAgent;t=e.indexOf("Windows")>=0}const e=/^\w[\w\d+.-]*$/,i=/^\//,o=/^\/\//;function s(t,r){if(!t.scheme&&r)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t.authority}", path: "${t.path}", query: "${t.query}", fragment: "${t.fragment}"}`);if(t.scheme&&!e.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path)if(t.authority){if(!i.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(o.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}const h="",a="/",c=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class f{static isUri(t){return t instanceof f||!!t&&"string"==typeof t.authority&&"string"==typeof t.fragment&&"string"==typeof t.path&&"string"==typeof t.query&&"string"==typeof t.scheme&&"string"==typeof t.fsPath&&"function"==typeof t.with&&"function"==typeof t.toString}scheme;authority;path;query;fragment;constructor(t,e,r,n,i,o=!1){"object"==typeof t?(this.scheme=t.scheme||h,this.authority=t.authority||h,this.path=t.path||h,this.query=t.query||h,this.fragment=t.fragment||h):(this.scheme=function(t,e){return t||e?t:"file"}(t,o),this.authority=e||h,this.path=function(t,e){switch(t){case"https":case"http":case"file":e?e[0]!==a&&(e=a+e):e=a}return e}(this.scheme,r||h),this.query=n||h,this.fragment=i||h,s(this,o))}get fsPath(){return m(this,!1)}with(t){if(!t)return this;let{scheme:e,authority:r,path:n,query:i,fragment:o}=t;return void 0===e?e=this.scheme:null===e&&(e=h),void 0===r?r=this.authority:null===r&&(r=h),void 0===n?n=this.path:null===n&&(n=h),void 0===i?i=this.query:null===i&&(i=h),void 0===o?o=this.fragment:null===o&&(o=h),e===this.scheme&&r===this.authority&&n===this.path&&i===this.query&&o===this.fragment?this:new l(e,r,n,i,o)}static parse(t,e=!1){const r=c.exec(t);return r?new l(r[2]||h,C(r[4]||h),C(r[5]||h),C(r[7]||h),C(r[9]||h),e):new l(h,h,h,h,h)}static file(e){let r=h;if(t&&(e=e.replace(/\\/g,a)),e[0]===a&&e[1]===a){const t=e.indexOf(a,2);-1===t?(r=e.substring(2),e=a):(r=e.substring(2,t),e=e.substring(t)||a)}return new l("file",r,e,h,h)}static from(t){const e=new l(t.scheme,t.authority,t.path,t.query,t.fragment);return s(e,!0),e}toString(t=!1){return y(this,t)}toJSON(){return this}static revive(t){if(t){if(t instanceof f)return t;{const e=new l(t);return e._formatted=t.external,e._fsPath=t._sep===u?t.fsPath:null,e}}return t}}const u=t?1:void 0;class l extends f{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=m(this,!1)),this._fsPath}toString(t=!1){return t?y(this,!0):(this._formatted||(this._formatted=y(this,!1)),this._formatted)}toJSON(){const t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=u),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t}}const g={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function d(t,e,r){let n,i=-1;for(let o=0;o<t.length;o++){const s=t.charCodeAt(o);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||45===s||46===s||95===s||126===s||e&&47===s||r&&91===s||r&&93===s||r&&58===s)-1!==i&&(n+=encodeURIComponent(t.substring(i,o)),i=-1),void 0!==n&&(n+=t.charAt(o));else{void 0===n&&(n=t.substr(0,o));const e=g[s];void 0!==e?(-1!==i&&(n+=encodeURIComponent(t.substring(i,o)),i=-1),n+=e):-1===i&&(i=o)}}return-1!==i&&(n+=encodeURIComponent(t.substring(i))),void 0!==n?n:t}function p(t){let e;for(let r=0;r<t.length;r++){const n=t.charCodeAt(r);35===n||63===n?(void 0===e&&(e=t.substr(0,r)),e+=g[n]):void 0!==e&&(e+=t[r])}return void 0!==e?e:t}function m(e,r){let n;return n=e.authority&&e.path.length>1&&"file"===e.scheme?`//${e.authority}${e.path}`:47===e.path.charCodeAt(0)&&(e.path.charCodeAt(1)>=65&&e.path.charCodeAt(1)<=90||e.path.charCodeAt(1)>=97&&e.path.charCodeAt(1)<=122)&&58===e.path.charCodeAt(2)?r?e.path.substr(1):e.path[1].toLowerCase()+e.path.substr(2):e.path,t&&(n=n.replace(/\//g,"\\")),n}function y(t,e){const r=e?p:d;let n="",{scheme:i,authority:o,path:s,query:h,fragment:c}=t;if(i&&(n+=i,n+=":"),(o||"file"===i)&&(n+=a,n+=a),o){let t=o.indexOf("@");if(-1!==t){const e=o.substr(0,t);o=o.substr(t+1),t=e.lastIndexOf(":"),-1===t?n+=r(e,!1,!1):(n+=r(e.substr(0,t),!1,!1),n+=":",n+=r(e.substr(t+1),!1,!0)),n+="@"}o=o.toLowerCase(),t=o.lastIndexOf(":"),-1===t?n+=r(o,!1,!0):(n+=r(o.substr(0,t),!1,!0),n+=o.substr(t))}if(s){if(s.length>=3&&47===s.charCodeAt(0)&&58===s.charCodeAt(2)){const t=s.charCodeAt(1);t>=65&&t<=90&&(s=`/${String.fromCharCode(t+32)}:${s.substr(3)}`)}else if(s.length>=2&&58===s.charCodeAt(1)){const t=s.charCodeAt(0);t>=65&&t<=90&&(s=`${String.fromCharCode(t+32)}:${s.substr(2)}`)}n+=r(s,!0,!1)}return h&&(n+="?",n+=r(h,!1,!1)),c&&(n+="#",n+=e?c:d(c,!1,!1)),n}function v(t){try{return decodeURIComponent(t)}catch{return t.length>3?t.substr(0,3)+v(t.substr(3)):t}}const b=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function C(t){return t.match(b)?t.replace(b,(t=>v(t))):t}var A=r(470);const w=A.posix||A,x="/";var P;!function(t){t.joinPath=function(t,...e){return t.with({path:w.join(t.path,...e)})},t.resolvePath=function(t,...e){let r=t.path,n=!1;r[0]!==x&&(r=x+r,n=!0);let i=w.resolve(r,...e);return n&&i[0]===x&&!t.authority&&(i=i.substring(1)),t.with({path:i})},t.dirname=function(t){if(0===t.path.length||t.path===x)return t;let e=w.dirname(t.path);return 1===e.length&&46===e.charCodeAt(0)&&(e=""),t.with({path:e})},t.basename=function(t){return w.basename(t.path)},t.extname=function(t){return w.extname(t.path)}}(P||(P={}))})(),LIB=n})();const{URI,Utils}=LIB;
23681 //# sourceMappingURL=index.mjs.map
23682 
23683 /***/ })
23684 
23685 }]);
23686 //# sourceMappingURL=3197.c29a6f351f8c45adc2c5.js.map?v=c29a6f351f8c45adc2c5